1
0
Fork 1
mirror of https://github.com/pixelfed/pixelfed.git synced 2024-12-27 02:06:52 +00:00
pixelfed/app/Http/Middleware/Admin.php

27 lines
486 B
PHP
Raw 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);
}
}