# Authorisation

Lantern hooks straight in to Laravel’s authorisation system.

During the setup process, Lantern will register a Laravel gate (opens new window) with the id of each Action that has been declared during set-up.

So, for example, let's say you have an Action called UpdateProject. This will have an id of update-project which you can use with Laravel's built-in authorisation options.

Dependencies

Any dependencies declared in the __construct() method of your Actions must be passed through as additional parameters whenever authorising using Laravel's built-in methods described below.

Laravel Debugbar

If you have Laravel Debugbar (opens new window) enabled, you will see a tab called Authorisation that will output all of the different gates that are automatically made available by Lantern.

# With middleware

Your Actions can be authorised using Laravel's middleware authorisation (opens new window).

Any dependencies that are needed for your Action, will need to come through Laravel's Route Model Binding (opens new window).

# With Blade

Your Actions can be authorised using Laravel's Blade directives (opens new window).

<ul>
@foreach($checklists as $list)
    @can('show-todo-list', $list)
        <li>
            <a href="{{ route('show-todo-list', ['todolist' => $list]) }}">
                {{ $list->name }}</a>
        </li>    
    @endcan
@endforeach
</ul>

If you have multiple dependencies for your Action, the 2nd argument of can() should be an array if you need to pass in multiple dependencies, e.g.:

@can('show-company-todo-list', [$company, $list])

# Feature stacks

If you have provided a Feature stack name for your Feature graph, then that STACK name must be prefixed to the Action id when checking for authorisation.

For example:

# Further reading

Since Action Availability is handled through gates, you can use any of Laravel's methods for authorising actions: