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
+51 -32
View File
@@ -7,6 +7,10 @@ use Illuminate\Support\Facades\Blade;
use Illuminate\Support\Facades\View;
use Illuminate\Support\ServiceProvider;
use Intervention\Image\ImageManager;
use Lucent\Account\AuthService;
use Lucent\Account\AuthServiceLunar;
use Lucent\Account\UserRepo;
use Lucent\Account\UserRepoLunar;
use Lucent\Channel\ChannelService;
use Lucent\Commands\CompileSchemas;
use Lucent\Commands\GenerateCollectionSchema;
@@ -17,10 +21,8 @@ use Lucent\Commands\RemoveOrphanEdges;
use Lucent\Commands\SetupDatabase;
use Lucent\Commands\UpgradeFiles122;
use Lucent\File\FileService;
use Lucent\File\ImageService;
use Lucent\Query\DatabaseGraph\DatabaseGraph;
use Lucent\Query\DatabaseGraph\PgsqlDatabaseGraph;
use Lucent\Query\DatabaseGraph\SqliteDatabaseGraph;
class LucentServiceProvider extends ServiceProvider
{
@@ -34,21 +36,20 @@ class LucentServiceProvider extends ServiceProvider
});
$this->app->bind(ImageManager::class, function () {
return new ImageManager(['driver' => 'imagick']);
return new ImageManager(["driver" => "imagick"]);
});
$this->app->bind(DatabaseGraph::class, function () {
$dbConnection = config("lucent.database");
return match (config("database.connections.$dbConnection.driver")) {
"sqlite" => new SqliteDatabaseGraph(),
"pgsql" => new PgsqlDatabaseGraph(),
};
return new PgsqlDatabaseGraph();
});
$this->app->bind(UserRepo::class, function () {
return new UserRepoLunar();
});
$this->app->bind(AuthService::class, function ($app) {
return $app->make(AuthServiceLunar::class);
});
}
/**
@@ -56,20 +57,29 @@ class LucentServiceProvider extends ServiceProvider
*/
public function boot(Router $router): void
{
$manifestPath = public_path('vendor/lucent/dist/manifest.json');
$manifestPath = public_path("vendor/lucent/dist/manifest.json");
$manifest = null;
if (file_exists($manifestPath)) {
$manifest = json_decode(file_get_contents(public_path('vendor/lucent/dist/manifest.json')), true);
$manifest = json_decode(
file_get_contents(
public_path("vendor/lucent/dist/manifest.json"),
),
true,
);
}
$router->aliasMiddleware(
"lucent.auth",
\Lucent\Http\Middleware\AuthMiddleware::class,
);
$router->aliasMiddleware(
"lucent.guest",
\Lucent\Http\Middleware\GuestMiddleware::class,
);
$router->aliasMiddleware('lucent.auth', \Lucent\Http\Middleware\AuthMiddleware::class);
$router->aliasMiddleware('lucent.guest', \Lucent\Http\Middleware\GuestMiddleware::class);
$this->loadViewsFrom(__DIR__ . '/../front/views', 'lucent');
$this->loadRoutesFrom(__DIR__ . '/Http/web.php');
$this->loadRoutesFrom(__DIR__ . '/Http/api.php');
$this->loadViewsFrom(__DIR__ . "/../front/views", "lucent");
$this->loadRoutesFrom(__DIR__ . "/Http/web.php");
$this->loadRoutesFrom(__DIR__ . "/Http/api.php");
if ($this->app->runningInConsole()) {
$this->commands([
@@ -84,19 +94,28 @@ class LucentServiceProvider extends ServiceProvider
]);
}
View::share('manifest', $manifest);
View::share('file', app()->make(FileService::class));
Blade::anonymousComponentPath(__DIR__ . '../front/views/components', "lucent");
$this->publishes([
__DIR__ . '/Config/main.php' => config_path('lucent.php'),
],"lucent-config");
$this->publishes([
__DIR__ . '/../front/dist' => public_path('vendor/lucent/dist'),
__DIR__ . '/../front/public' => public_path('vendor/lucent/public'),
], 'lucent');
View::share("manifest", $manifest);
View::share("file", app()->make(FileService::class));
Blade::anonymousComponentPath(
__DIR__ . "../front/views/components",
"lucent",
);
$this->publishes(
[
__DIR__ . "/Config/main.php" => config_path("lucent.php"),
],
"lucent-config",
);
$this->publishes(
[
__DIR__ . "/../front/dist" => public_path("vendor/lucent/dist"),
__DIR__ . "/../front/public" => public_path(
"vendor/lucent/public",
),
],
"lucent",
);
}
}