2020-06-26 23:32:33 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Middleware;
|
|
|
|
|
|
|
|
use Closure;
|
|
|
|
use Illuminate\Support\Facades\Auth;
|
|
|
|
|
|
|
|
class ForceLogoutMiddleware
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Handle an incoming request.
|
|
|
|
*
|
|
|
|
* @param \Illuminate\Http\Request $request
|
|
|
|
* @param \Closure $next
|
|
|
|
* @return mixed
|
|
|
|
*/
|
|
|
|
public function handle($request, Closure $next)
|
|
|
|
{
|
2020-10-21 00:29:50 +00:00
|
|
|
if (Auth::user()->isBanned())
|
|
|
|
{
|
2020-06-26 23:32:33 +00:00
|
|
|
Auth::logout();
|
|
|
|
|
|
|
|
$request->session()->flash('error', 'Error: Your session has been forcefully terminated. Please try again in a few days.');
|
|
|
|
return redirect('/');
|
|
|
|
}
|
|
|
|
|
|
|
|
return $next($request);
|
|
|
|
}
|
|
|
|
}
|