kei_mx wrote a comment+100 XP
2d ago
Great, thank you for this series!
kei_mx liked a comment+100 XP
1w ago
Absolutely, you can add custom methods to your Laravel policies beyond the default ones like view, create, update, and delete.
For example, if you want to add a method like createOwn to only allow users to create resources they "own," you can define it just like any other policy method:
public function createOwn(User $user, SomeModel $model)
{
return $user->id === $model->user_id;
}
Once you've added a custom method, you can authorize it in your controllers/blades using:
$this->authorize('createOwn', $model);
// or
@can('createOwn', $model)
<!-- show create button -->
@endcan
So, you are not limited to the default methods. Feel free to add authorization logic that fits your application's needs!
kei_mx liked a comment+100 XP
4mos ago
First <3
@Jeffrey Way can you release a series on how to deploy a Laravel app with Docker in 2026 (maybe FrankenPHP)?
kei_mx wrote a reply+100 XP
4mos ago
Hello.
First of all, why use permissions in your package?