An error has occurred where I set the validation.
put validation(policy) in index.blade `(@ can ~ endcan)`, and click "Edit",
`403 This action is unauthorized.` Is displayed and I cannot move to the edit page.
I want the code to be able to move to the Edit page.

I tried bb on PostPolicy.
2nd line is null. What do I need to do to...?
Please help.

[![Debug](https://i.stack.imgur.com/cEZ7o.png)](https://i.stack.imgur.com/cEZ7o.png)

### PostFactory

```php
$factory->define(Post::class, function (Faker $faker) {
    return [
        'created_at' => $faker->date('Y-m-d H:i:s', 'now'),
        'updated_at' => $faker->date('Y-m-d H:i:s', 'now'),
        'subject' => $faker->realText(16),
        'message' => $faker->realText(200),
        'name' => $faker->name,
        'user_id' => factory(App\User::class), 
    ];
});

```

### UserFactory

```

$factory->define(User::class, function (Faker $faker) {
    return [
        'name' => $faker->name,
        'email' => $faker->unique()->safeEmail,
        'email_verified_at' => now(),
        'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
        'remember_token' => Str::random(10),
    ];
});

```

### PostPolicy.php

```php
    /**
     * 編集と削除の認可を判断する。
     *
     * @param  \App\User $user 
     * @param  \App\Post $post 
     * @return mixed
     */
    public function edit(User $user, Post $post)
    {
        dump($user->id);
        dd($post->user_id);
        return $user->id === $post->user_id;
        #return $user->id == $post->user_id;
    }

    public function update(User $user, Post $post)
    {
        return $user->id === $post->user_id;
    }
}

```

### UserPolicy.php

```
    /**
     * 編集と削除の認可を判断する。
     *
     * @param  \App\User $user  
     * @param  \App\User $model 
     * @return mixed
     */
    public function edit(User $user, User $model)
    {
        return $user->id == $model->id;
    }

```