boboko lulnar

This commit is contained in:
2026-04-20 21:07:35 +03:00
parent 57b0727788
commit 4a7eb217a1
32 changed files with 1350 additions and 858 deletions
+31 -21
View File
@@ -5,44 +5,54 @@ namespace Lucent\Svelte;
use Illuminate\Contracts\View\Factory;
use Illuminate\Contracts\View\View;
use Lucent\Account\AccountService;
use Lucent\Account\AuthService;
use Lucent\Channel\ChannelService;
class Svelte
class Svelte
{
public function __construct(
public ChannelService $channelService,
public AccountService $accountService
)
{
}
function render(string $layout, string $view, string $title = "", mixed $data = []): View|Factory
{
public AccountService $accountService,
public AuthService $authService,
) {}
function render(
string $layout,
string $view,
string $title = "",
mixed $data = [],
): View|Factory {
$context = [];
$context["user"] = session('user');
$context["user"] = toArray($this->authService->getCurrentUser());
$context["view"] = $view;
$context["layout"] = $layout;
$context["title"] = $title;
$context["data"] = $data;
$context["channel"] = $this->channelService->channel;
$context["readableSchemas"] = $this->accountService->currentReadableSchemas();
$context[
"readableSchemas"
] = $this->accountService->currentReadableSchemas();
$json = json_encode($context);
$divTag = sprintf('<div class="lucent-component" data-layout="%s"></div>', $layout);
$jsonTag = sprintf('<script type="application/json" id="json-%s">%s</script>', $layout, $json);
$divTag = sprintf(
'<div class="lucent-component" data-layout="%s"></div>',
$layout,
);
$jsonTag = sprintf(
'<script type="application/json" id="json-%s">%s</script>',
$layout,
$json,
);
$svelte = $divTag . $jsonTag;
return view('lucent::svelte', [
'svelte' => $svelte,
'view' => $view,
'data' => $data,
'title' => $title,
'layout' => $layout,
'channel' => $this->channelService->channel,
return view("lucent::svelte", [
"svelte" => $svelte,
"view" => $view,
"data" => $data,
"title" => $title,
"layout" => $layout,
"channel" => $this->channelService->channel,
]);
}
}