transition

This commit is contained in:
2024-08-14 22:04:34 +03:00
parent 1ab3f678b7
commit 1f3ebafe69
50 changed files with 924 additions and 172 deletions
+9 -3
View File
@@ -4,15 +4,19 @@ namespace Lucent\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\View;
use Lucent\Account\AccountService;
use Lucent\Account\AuthService;
use Lucent\Channel\ChannelService;
use Lucent\ViewModel\ViewModel;
readonly class AuthMiddleware
{
public function __construct(
private AuthService $authService,
private ChannelService $channelService
private AccountService $accountService,
private ChannelService $channelService,
private ViewModel $viewModel
)
{
}
@@ -22,9 +26,11 @@ readonly class AuthMiddleware
if (!$this->authService->isLoggedIn()) {
return redirect($this->channelService->channel->lucentUrl . "/login");
}
$this->authService->refreshSession();
View::share("channel",$this->channelService->channel);
View::share("user",session("user"));
View::share("schemas",$this->channelService->channel->schemas->whereIn("name",$this->accountService->currentReadableSchemas())->values());
View::share("viewModel",$this->viewModel);
return $next($request);
}