mirror of
https://github.com/Aviortheking/CA_LARAVEL.git
synced 2025-04-23 03:12:12 +00:00
47 lines
504 B
PHP
47 lines
504 B
PHP
<?php
|
||
|
||
|
||
|
||
namespace App\Http\Middleware;
|
||
|
||
|
||
|
||
use Closure;
|
||
|
||
|
||
|
||
class IsAdmin
|
||
|
||
{
|
||
|
||
/**
|
||
|
||
* Handle an incoming request.
|
||
|
||
*
|
||
|
||
* @param \Illuminate\Http\Request $request
|
||
|
||
* @param \Closure $next
|
||
|
||
* @return mixed
|
||
|
||
*/
|
||
|
||
public function handle($request, Closure $next)
|
||
|
||
{
|
||
|
||
if(auth()->user()->is_admin == 1){
|
||
|
||
return $next($request);
|
||
|
||
}
|
||
|
||
|
||
|
||
return redirect(‘home’)->with(‘error’,"You don't have admin access.");
|
||
|
||
}
|
||
|
||
} |