%PDF- %PDF-
Direktori : /home/silvzytp/dsr_code/app/Http/Middleware/ |
Current File : /home/silvzytp/dsr_code/app/Http/Middleware/MemberMiddleware.php |
<?php namespace App\Http\Middleware; use Closure; use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; class MemberMiddleware { /** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next * @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse */ public function handle(Request $request, Closure $next) { if (Auth::check() && in_array(Auth::user()->role->slug,['admin','manager']) == true) { return $next($request); }else{ Auth::logout(); return redirect()->route('login')->with('error','Your credential wrong!'); } } }