title: Laravel - 403 redirect. Redirect is correct working for tags and category sections but not for users
body: <p>I'm trying to set the post admin section. The mission for that section is to show all articles that belong to logged user. The way I'm doing for tags and categories is working correct (tags and categories doesn't need to be filtered for any user). The post page works correctly show the owned post for logged user, but the problem is that the user can't edit or show any post and trying to store a new post redirects to 403 page. I'm confuse by the error and I don't have any solution. I appreciate some help.</p>
  <p>PostModel</p>
  <pre><code>&lt;?php
  
  namespace App\Models;
  
  use Illuminate\Database\Eloquent\Factories\HasFactory;
  use Illuminate\Database\Eloquent\Model;
  
  class Post extends Model
  {
      use HasFactory;
      
      protected $fillable = [
          'user_id', 'category_id', 'name', 'slug', 'excerpt', 'body', 'status', 'file'
      ];
  
      public function category()
      {
          return $this-&gt;belongsTo(Category::class);
      }
  
      public function user()
      {
          return $this-&gt;belongsTo(User::class);
      }
  
      public function tags()
      {
          return $this-&gt;belongsToMany(Tag::class);
      }
      
  }
  </code></pre>
  <p>PostController</p>
  <pre><code>&lt;?php
  
  namespace App\Http\Controllers\Admin;
  
  use App\Models\Post;
  use App\Models\Category;
  use App\Models\Tag;
  
  use App\Http\Controllers\Controller;
  use Illuminate\Http\Request;
  
  use App\Http\Requests\PostStoreRequest;
  use App\Http\Requests\PostUpdateRequest;
  
  use Illuminate\Support\Facades\Storage;
  
  class PostController extends Controller
  {
      /**
       * Create a new controller instance.
       *
       * @return void
       */
      public function __construct()
      {
          $this-&gt;middleware('auth');
      }
      
      public function index()
      {
          $posts = Post::orderBy('id', 'DESC')
              -&gt;where('user_id', auth()-&gt;user()-&gt;id)
              -&gt;paginate();
  
          return view('admin.posts.index', compact('posts'));
      }
  
      public function create()
      {
          $categories = Category::orderBy('name', 'ASC')-&gt;pluck('name', 'id');
          $tags       = Tag::orderBy('name', 'ASC')-&gt;get();
  
          return view('admin.posts.create', compact('categories', 'tags'));
      }
  
      public function store(PostStoreRequest $request)
      {
          $post = Post::create($request-&gt;all());
          $this-&gt;authorize('pass', $post);
  
          //IMAGE 
          if($request-&gt;file('image')){
              $path = Storage::disk('public')-&gt;put('image',  $request-&gt;file('image'));
              $post-&gt;fill(['file' =&gt; asset($path)])-&gt;save();
          }
  
          //TAGS
          $post-&gt;tags()-&gt;attach($request-&gt;get('tags'));
  
          return redirect()-&gt;route('posts.edit', $post-&gt;id)-&gt;with('info', 'Success');
      }
  
      public function show($id)
      {
          $post = Post::find($id);
          $this-&gt;authorize('pass', $post);
  
          return view('admin.posts.show', compact('post'));
      }
  
      public function edit($id)
      {
          $categories = Category::orderBy('name', 'ASC')-&gt;pluck('name', 'id');
          $tags       = Tag::orderBy('name', 'ASC')-&gt;get();
          $post       = Post::find($id);
          $this-&gt;authorize('pass', $post);
          
          return view('admin.posts.edit', compact('post', 'categories', 'tags'));
      }
  
      public function update(PostUpdateRequest $request, $id)
      {
          $post = Post::find($id);
          $this-&gt;authorize('pass', $post);
  
          $post-&gt;fill($request-&gt;all())-&gt;save();
  
          //IMAGE 
          if($request-&gt;file('image')){
              $path = Storage::disk('public')-&gt;put('image',  $request-&gt;file('image'));
              $post-&gt;fill(['file' =&gt; asset($path)])-&gt;save();
          }
  
          //TAGS
          $post-&gt;tags()-&gt;sync($request-&gt;get('tags'));
  
          return redirect()-&gt;route('posts.edit', $post-&gt;id)-&gt;with('info', 'Success');
      }
  
      public function destroy($id)
      {
          $post = Post::find($id)-&gt;delete();
          $this-&gt;authorize('pass', $post);
  
          return back()-&gt;with('info', 'Deleted');
      }
  }
  </code></pre>
  <p>PostUpdateRequest</p>
  <pre><code>&lt;?php
  
  namespace App\Http\Requests;
  
  use Illuminate\Foundation\Http\FormRequest;
  
  class PostUpdateRequest extends FormRequest
  {
      public function authorize()
      {
          return true;
      }
  
      public function rules()
      {
          $rules = [
              'name'          =&gt; 'required',
              'slug'          =&gt; 'required|unique:posts,slug,' . $this-&gt;post,
              'user_id'       =&gt; 'required|integer',
              'category_id'   =&gt; 'required|integer',
              'tags'          =&gt; 'required|array',
              'body'          =&gt; 'required',
              'status'        =&gt; 'required|in:DRAFT,PUBLISHED',
          ];
  
          if($this-&gt;get('image'))        
              $rules = array_merge($rules, ['image'         =&gt; 'mimes:jpg,jpeg,png']);
  
          return $rules;
      }
  }
  </code></pre>
  <p>PostStoreRequest</p>
  <pre><code>&lt;?php
  
  namespace App\Http\Requests;
  
  use Illuminate\Foundation\Http\FormRequest;
  
  class PostStoreRequest extends FormRequest
  {
      public function authorize()
      {
          return true;
      }
  
      public function rules()
      {
          $rules = [
              'name'          =&gt; 'required',
              'slug'          =&gt; 'required|unique:posts,slug',
              'user_id'       =&gt; 'required|integer',
              'category_id'   =&gt; 'required|integer',
              'tags'          =&gt; 'required|array',
              'body'          =&gt; 'required',
              'status'        =&gt; 'required|in:DRAFT,PUBLISHED',            
          ];
  
          if($this-&gt;get('image'))        
              $rules = array_merge($rules, ['image'         =&gt; 'mimes:jpg,jpeg,png']);
  
          return $rules;
      }
  }
  </code></pre>
  <p>And for example, the post.edit</p>
  <pre><code>@extends('admin.admin')
  @section('content')
  &lt;div class=&quot;container&quot;&gt;
      &lt;div class=&quot;row&quot;&gt;
          &lt;div class=&quot;col-md-8 col-md-offset-2&quot;&gt;
              &lt;div class=&quot;card&quot;&gt;
                  &lt;div class=&quot;card-header&quot;&gt;
                     {{ __('Editar artículo') }}
                  &lt;/div&gt;
  
                  &lt;div class=&quot;card-body&quot;&gt;
                     {!! Form::model($post, ['route' =&gt; ['posts.update', $post-&gt;id], 'method' =&gt; 'PUT']) !!}
                       @include('admin.posts.partials.form')
                     {!! Form::close() !!} 
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  @endsection
  </code></pre>
  <p>And finally the form</p>
  <pre><code>&lt;div class=&quot;form-group&quot;&gt;
  {{ Form::hidden('user_id', auth()-&gt;user()-&gt;id) }}
  &lt;/div&gt; 
  &lt;div class=&quot;form-group&quot;&gt;
      {{ Form::label('category_id', 'Category') }}
      {{ Form::select('category_id', $categories, null, ['class' =&gt; 'form-control']) }}
  &lt;/div&gt; 
  &lt;div class=&quot;form-group&quot;&gt;
      {{ Form::label('name', 'Tag name') }}
      {{ Form::text('name', null, ['class' =&gt; 'form-control', 'id' =&gt; 'name']) }}
  &lt;/div&gt;
  &lt;div class=&quot;form-group&quot;&gt;
      {{ Form::label('slug', 'URL friendly') }}
      {{ Form::text('slug', null, ['class' =&gt; 'form-control', 'id' =&gt; 'slug']) }}
  &lt;/div&gt;
  &lt;div class=&quot;form-group&quot;&gt;
      {{ Form::label('image', 'Image') }}
      {{ Form::file('image') }}
  &lt;/div&gt;
  &lt;div class=&quot;form-group&quot;&gt;
      {{ Form::label('slug', 'State') }}
      &lt;label&gt;
          {{ Form::radio('status', 'PUBLISHED') }} Published
      &lt;/label&gt;
      &lt;label&gt;
          {{ Form::radio('status', 'DRAFT') }} Draft
      &lt;/label&gt;
  &lt;/div&gt;
  &lt;div class=&quot;form-group&quot;&gt;
      {{ Form::label('tags', 'Tags') }}
      &lt;div&gt;
      @foreach($tags as $tag)
          &lt;label&gt;
              {{ Form::checkbox('tags[]', $tag-&gt;id) }} {{ $tag-&gt;name }}
          &lt;/label&gt;
      @endforeach
      &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class=&quot;form-group&quot;&gt;
      {{ Form::label('excerpt', 'Excerpt') }}
      {{ Form::textarea('excerpt', null, ['class' =&gt; 'form-control', 'rows' =&gt; '2']) }}
  &lt;/div&gt;
  &lt;div class=&quot;form-group&quot;&gt;
      {{ Form::label('body', 'Description') }}
      {{ Form::textarea('body', null, ['class' =&gt; 'form-control']) }}
  &lt;/div&gt;
  &lt;div class=&quot;form-group&quot;&gt;
      {{ Form::submit('Guardar', ['class' =&gt; 'btn btn-sm btn-primary']) }}
  &lt;/div&gt;
  
  @section('scripts')
  &lt;script src=&quot;{{ asset('components/stringToSlug/jquery.stringToSlug.min.js') }}&quot;&gt;&lt;/script&gt;
  &lt;script&gt;
      $(document).ready(function(){
          $(&quot;#name, #slug&quot;).stringToSlug({
              callback: function(text){
                  $('#slug').val(text);
              }
          });
      });
  &lt;/script&gt;
  @endsection
  </code></pre>
  <p>Sorry for the extension but it was necessary to explain the problem.</p>