Gates: Authorizing Actions

If (Gate::allows('update-post', $post)) {
    // The current user can update the post...
}

if (Gate::denies('update-post', $post)) {
    // The current user can't update the post...
}
If (Gate::forUser($user)->allows('update-post', $post)) {
    // The user can update the post...
}

if (Gate::forUser($user)->denies('update-post', $post)) {
    // The user can't update the post...
}

Intercepting Gate Checks

Gate::before(function ($user, $ability) {
    if ($user->isSuperAdmin()) {
        return true;
    }
});
Gate::after(function ($user, $ability, $result, $arguments) {
    //
});

Gates: Authorizing Actions — Structure map

Clickable & Draggable!

Gates: Authorizing Actions — Related pages: