permissions

This commit is contained in:
2023-10-17 22:57:25 +03:00
parent 4b9e9cb4f6
commit 632684f514
29 changed files with 370 additions and 223 deletions
+7 -2
View File
@@ -4,22 +4,27 @@ namespace Lucent\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Lucent\Account\AccountService;
use Lucent\Account\AuthService;
use Lucent\Channel\ChannelService;
readonly class AuthMiddleware
{
public function __construct(private AuthService $authService, private ChannelService $channelService)
public function __construct(
private AccountService $accountService,
private AuthService $authService,
private ChannelService $channelService
)
{
}
public function handle(Request $request, Closure $next)
{
if (!$this->authService->isLoggedIn()) {
return redirect($this->channelService->channel->lucentUrl . "/login");
}
return $next($request);
}
}