pixelfed/app/Http/Middleware/Admin.php

27 lines
486 B
PHP
Raw Permalink Normal View History

2018-05-20 02:58:45 +00:00
<?php
namespace App\Http\Middleware;
2018-08-28 03:07:36 +00:00
use Auth;
use Closure;
2018-05-20 02:58:45 +00:00
class Admin
{
/**
* Handle an incoming request.
*
2018-08-28 03:07:36 +00:00
* @param \Illuminate\Http\Request $request
* @param \Closure $next
*
2018-05-20 02:58:45 +00:00
* @return mixed
*/
public function handle($request, Closure $next)
{
2018-08-28 03:07:36 +00:00
if (Auth::check() == false || Auth::user()->is_admin == false) {
2018-05-20 02:58:45 +00:00
return redirect(config('app.url'));
}
return $next($request);
}
}