Laravel 6

Laravel 6

Authorisation

User actions against a given resource. There are two primary ways of authorising actions: gates and policies

Think of:

  • gates like -> routes
  • and policies like controllers.

Gates provide a simple, Closure based approach to authorization while policies, like controllers, group their logic around a particular model or resource.

Gates are most applicable to actions which are not related to any model or resource, such as viewing an administrator dashboard. In contrast, policies should be used when you wish to authorize an action for a particular model or resource.

Gates: