“Laravel Make: Middleware” Respostas de código

Laravel Make: Middleware

php artisan make:middleware AdminMiddleware
Different Dogfish

Laravel Make: Middleware

public function handle($request, Closure $next)
{
    if ($request->user()->type != 'A')
    {
        return redirect('home');
    }

    return $next($request);
}
Different Dogfish

Laravel Make: Middleware

Route::group(['middleware' => 'App\Http\Middleware\AdminMiddleware'], function()
{
    Route::get ('/admin', ['uses' => 'AdminController@index', 'before' => 'admin']); 

});
Different Dogfish

Laravel Make: Middleware

if (Auth::user()->is_admin != 1) {...}
Different Dogfish

Respostas semelhantes a “Laravel Make: Middleware”

Perguntas semelhantes a “Laravel Make: Middleware”

Mais respostas relacionadas para “Laravel Make: Middleware” em PHP

Procure respostas de código populares por idioma

Procurar outros idiomas de código