When permissions depend on a specific model, keep the rules in a policy instead of repeating ownership checks across controllers. Laravel can discover a policy when it follows the usual model and policy naming convention.
Generate a policy with starter methods for a model:
php artisan make:policy PostPolicy --model=Post
For example, restrict updates to the post owner:
public function update(User $user, Post $post): bool
{
return $user->id === $post->user_id;
}
Then authorize the action at the controller boundary:
$this->authorize('update', $post);
Policies can also be used from routes, Blade, and the Gate facade, keeping the same rule available throughout the application.