Download src/app/Http/Middleware/CheckUserStatus.php from pnacorp/xsender: direct link, hf CLI and curl.
- Browser
- Download file 623 Bytes
-
https://huggingface.co/pnacorp/xsender/resolve/main/src/app/Http/Middleware/CheckUserStatus.php
- Command line
-
hf download hf://pnacorp/xsender/src/app/Http/Middleware/CheckUserStatus.php
-
curl -L -o CheckUserStatus.php https://huggingface.co/pnacorp/xsender/resolve/main/src/app/Http/Middleware/CheckUserStatus.php
623 Bytes
| namespace App\Http\Middleware; | |
| use App\Enums\StatusEnum; | |
| use App\Http\Controllers\Auth\AuthenticatedSessionController; | |
| use App\Models\User; | |
| use Closure; | |
| use Illuminate\Http\Request; | |
| use Illuminate\Support\Facades\Auth; | |
| class CheckUserStatus | |
| { | |
| public function handle(Request $request, Closure $next) | |
| { | |
| if(Auth::check() && Auth::user()->status == StatusEnum::FALSE->status()) { | |
| $notify[] = ['error',translate("Your account is banned by admin")]; | |
| return (new AuthenticatedSessionController())->destroy()->withNotify($notify); | |
| } | |
| return $next($request); | |
| } | |
| } | |