This commit is contained in:
2023-10-02 23:10:49 +03:00
commit c6cb488379
255 changed files with 18731 additions and 0 deletions
+25
View File
@@ -0,0 +1,25 @@
<?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);
}
}
+22
View File
@@ -0,0 +1,22 @@
<?php
namespace Lucent\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Lucent\Account\AuthService;
readonly class GuestMiddleware
{
public function __construct(private AuthService $authService)
{
}
public function handle(Request $request, Closure $next)
{
if ($this->authService->isLoggedIn()) {
return redirect("/home");
}
return $next($request);
}
}