Initialer Laravel Commit für BetiX
Some checks failed
linter / quality (push) Has been cancelled
tests / ci (8.4) (push) Has been cancelled
tests / ci (8.5) (push) Has been cancelled

This commit is contained in:
2026-04-04 18:01:50 +02:00
commit 0280278978
374 changed files with 65210 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Inertia\Inertia;
class CheckBanned
{
public function handle(Request $request, Closure $next)
{
if (Auth::check() && Auth::user()->is_banned) {
// Get reason
$ban = Auth::user()->restrictions()->where('type', 'account_ban')->where('active', true)->first();
return Inertia::render('Errors/Banned', [
'reason' => $ban ? $ban->reason : 'No reason provided.'
])->toResponse($request)->setStatusCode(403);
}
return $next($request);
}
}