Created
November 2, 2017 15:26
-
-
Save geraldarcega/221fc307cf3607584e916eb150dc3839 to your computer and use it in GitHub Desktop.
IsAdmin middleware
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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() && \Auth::user()->type == 1) { | |
return $next($request); | |
} | |
return redirect('/'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment