crazy stuff

This commit is contained in:
2026-01-07 21:42:18 +02:00
parent 57b0727788
commit 874ddd33e2
41 changed files with 5580 additions and 5039 deletions
+11 -15
View File
@@ -14,21 +14,14 @@ use function Lucent\Response\ok;
class HomeController extends Controller
{
public function __construct(
private readonly Svelte $svelte,
private readonly Svelte $svelte,
private readonly AccountService $accountService,
private readonly Query $query,
)
{
}
private readonly Query $query,
) {}
public function home(): View
{
return $this->svelte->render(
layout: "channel",
view: "homeIndex",
title: "Records",
);
return $this->svelte->render(view: "homeIndex", title: "Records");
}
public function records(Request $request): Response
@@ -38,10 +31,13 @@ class HomeController extends Controller
$sort = data_get($urlParams, "sort") ?? "-_sys.updatedAt";
$filter = data_get($urlParams, "filter") ?? [];
$arguments = array_merge([
"schema_in" => $this->accountService->currentReadableSchemas(),
"status_in" => ["draft", "published"]
], $filter);
$arguments = array_merge(
[
"schema_in" => $this->accountService->currentReadableSchemas(),
"status_in" => ["draft", "published"],
],
$filter,
);
$limit = 20;
+28 -31
View File
@@ -1,18 +1,13 @@
<?php
namespace Lucent\Http\Controller;
use App\Http\Controllers\Controller;
use Illuminate\Contracts\View\View;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Lucent\Account\AccountService;
use Lucent\Channel\ChannelService;
use Lucent\LucentException;
use Lucent\Setup\Data\SetupStep;
use Lucent\Setup\Data\SetupStepStatus;
use Lucent\Setup\Setup;
use Lucent\Setup\Step\ComposerStep;
use Lucent\Setup\Step\DatabaseSetupStep;
use Lucent\Setup\Step\IStep;
@@ -21,52 +16,54 @@ use Lucent\Setup\Step\LucentConfigStep;
use Lucent\Setup\Step\StorageLinkSetupStep;
use Lucent\Setup\Step\StorageSetupStep;
use Lucent\Svelte\Svelte;
use function Lucent\Response\fail;
use function Lucent\Response\ok;
class SetupController
{
public function __construct(
private readonly AccountService $accountService,
private readonly ChannelService $channelService,
private readonly Svelte $svelte,
)
{
}
private readonly Svelte $svelte,
) {}
public function setup(Request $request): View|RedirectResponse
{
$steps = array_reduce(
[
new ComposerStep(),
new LucentConfigStep(),
new LaravelEnvStep(),
new StorageSetupStep(),
new StorageLinkSetupStep(),
new DatabaseSetupStep(),
],
fn(array $carry, IStep $setupStep) => array_merge($carry, [
$setupStep(),
]),
[],
);
$allSuccess = array_reduce(
$steps,
fn(bool $carry, SetupStep $step) => !$carry
? false
: $step->status === SetupStepStatus::SUCCESS,
true,
);
$steps = array_reduce([
new ComposerStep,
new LucentConfigStep,
new LaravelEnvStep,
new StorageSetupStep,
new StorageLinkSetupStep,
new DatabaseSetupStep,
], fn(array $carry, IStep $setupStep) => array_merge($carry, [$setupStep()]), []);
$allSuccess = array_reduce($steps, fn(bool $carry, SetupStep $step) => !$carry ? false : $step->status === SetupStepStatus::SUCCESS, true);
if($allSuccess){
if ($allSuccess) {
if ($this->accountService->countUsers() > 0) {
return redirect($this->channelService->channel->lucentUrl . "/login");
return redirect(
$this->channelService->channel->lucentUrl . "/login",
);
}
}
return $this->svelte->render(
layout: "account",
view: "setup",
title: "Setup Lucent",
data: [
"steps" => $steps,
"allSuccess" => $allSuccess,
]
],
);
}
}