2021-06-19 00:41:56 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Middleware;
|
|
|
|
|
|
|
|
use Illuminate\Http\Request;
|
|
|
|
use Illuminate\Support\Facades\Auth;
|
|
|
|
|
|
|
|
class ActiveUser
|
|
|
|
{
|
2021-07-04 11:47:23 +00:00
|
|
|
/**
|
|
|
|
* Handle an incoming request.
|
|
|
|
*
|
2023-06-27 07:39:11 +00:00
|
|
|
* @param Request $request
|
|
|
|
* @param \Closure $next
|
2021-07-04 11:47:23 +00:00
|
|
|
* @return mixed
|
|
|
|
*/
|
2023-06-27 07:39:11 +00:00
|
|
|
public function handle(Request $request,\Closure $next)
|
2021-07-04 11:47:23 +00:00
|
|
|
{
|
|
|
|
if (Auth::user()->exists && ! Auth::user()->active) {
|
|
|
|
Auth::logout();
|
|
|
|
abort(403,'Your account is not active');
|
2021-06-19 00:41:56 +00:00
|
|
|
}
|
|
|
|
|
2021-07-04 11:47:23 +00:00
|
|
|
return $next($request);
|
|
|
|
}
|
2021-06-19 00:41:56 +00:00
|
|
|
}
|