Appearance
Policy
- Policy class methods MUST use camelCase. Example:
@can('editPost', $post)(Laravel does it under the hood) - Try to name abilities using default CRUD words. One exception: replace
showwithview. A server shows a resource, a user views it. - Prefer to return
\Illuminate\Auth\Access\Responseinstances from policy methods as they provide better DX, and it allows building a better UX. - Do not use
HandlesAuthorizationtrait, use\Illuminate\Auth\Access\Responsemethods directly. - If Laravel Nova v5+ used on the project, use separate policy classes per Nova Resource (
Resource::$policy).