“Laravel Make: Middleware” Kode Jawaban

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

Jawaban yang mirip dengan “Laravel Make: Middleware”

Pertanyaan yang mirip dengan “Laravel Make: Middleware”

Lebih banyak jawaban terkait untuk “Laravel Make: Middleware” di PHP

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya