26 lines
553 B
PHP
26 lines
553 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace Lucent\Http\Middleware;
|
||
|
|
|
||
|
|
use Closure;
|
||
|
|
use Illuminate\Http\Request;
|
||
|
|
use Lucent\Account\AuthService;
|
||
|
|
use Lucent\Channel\ChannelService;
|
||
|
|
|
||
|
|
readonly class AuthMiddleware
|
||
|
|
{
|
||
|
|
public function __construct(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);
|
||
|
|
}
|
||
|
|
}
|