mardi 30 janvier 2018

Assign authorization middleware on entire resource laravel 5

Route::put('/post/{post}', function (Post $post) {
    // The current user may update the post...
})->middleware('can:update,post');

Instead of specify each action and its correspondance middleware authorization like above or calling middleware in controller, is there any way of doing it in single line. Like specifying All gates for resource.

Gate::resource('posts', 'PostPolicy');

I am mainly concerned about Resource.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire