mirror of
https://github.com/LinkStackOrg/LinkStack.git
synced 2024-12-29 11:01:15 +01:00
29 lines
505 B
PHP
Executable File
29 lines
505 B
PHP
Executable File
<?php
|
|
|
|
namespace App\Http\Middleware;
|
|
|
|
use Auth;
|
|
use Closure;
|
|
use Illuminate\Http\Request;
|
|
|
|
class admin
|
|
{
|
|
/**
|
|
* Handle an incoming request.
|
|
*
|
|
* @param \Illuminate\Http\Request $request
|
|
* @param \Closure $next
|
|
* @return mixed
|
|
*/
|
|
public function handle(Request $request, Closure $next)
|
|
{
|
|
|
|
//check is admin
|
|
if (Auth::user() && Auth::user()->role == 'admin') {
|
|
return $next($request);
|
|
}
|
|
|
|
return redirect('/');
|
|
}
|
|
}
|