mardi 14 février 2017

How to add custom middle inside a Route group in laravel

I have a Route group in laravel which has middleware of auth

Route::group(['middleware'=>'auth', function()
{
    //Routes
});

Now these routes are only available to logged in users. I have a situation that logged in users have privileges. I have some routes that are only to be visited by logged in users AND if they have privilege of OWNER

In function I have started a session and stored privilege value.

I did something like this

Route::group(['middleware'=>'auth', function()
{
    //Routes
    if(session::get('privilege')
    {
        //Routes
    }
});

This isn't working neither it's appropriate method. Can anyone tell me how add middleware inside a middleware?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2lLI4sU
via IFTTT

Aucun commentaire:

Enregistrer un commentaire