54 lines
1.4 KiB
PHP
54 lines
1.4 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace Lucent;
|
||
|
|
|
||
|
|
use Illuminate\Routing\Router;
|
||
|
|
use Illuminate\Support\Facades\View;
|
||
|
|
use Illuminate\Support\ServiceProvider as IlluminateServiceProvider;
|
||
|
|
use Lucent\Channel\ChannelService;
|
||
|
|
use Lucent\Commands\CompileConfig;
|
||
|
|
use Lucent\Commands\RebuildThumbnails;
|
||
|
|
use Lucent\File\ImageService;
|
||
|
|
|
||
|
|
class ServiceProvider extends IlluminateServiceProvider
|
||
|
|
{
|
||
|
|
/**
|
||
|
|
* Register any application services.
|
||
|
|
*/
|
||
|
|
public function register(): void
|
||
|
|
{
|
||
|
|
$this->app->singleton(ChannelService::class, function () {
|
||
|
|
return ChannelService::fromConfig();
|
||
|
|
});
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Bootstrap any package services.
|
||
|
|
*/
|
||
|
|
public function boot(Router $router): void
|
||
|
|
{
|
||
|
|
|
||
|
|
$router->aliasMiddleware('lucent.auth', \Lucent\Http\Middleware\AuthMiddleware::class);
|
||
|
|
$router->aliasMiddleware('lucent.guest', \Lucent\Http\Middleware\GuestMiddleware::class);
|
||
|
|
|
||
|
|
$this->loadViewsFrom(__DIR__ . '/Views', 'lucent');
|
||
|
|
$this->loadRoutesFrom(__DIR__ . '/Http/web.php');
|
||
|
|
$this->loadRoutesFrom(__DIR__ . '/Http/api.php');
|
||
|
|
|
||
|
|
|
||
|
|
if ($this->app->runningInConsole()) {
|
||
|
|
$this->commands([
|
||
|
|
CompileConfig::class,
|
||
|
|
RebuildThumbnails::class,
|
||
|
|
]);
|
||
|
|
}
|
||
|
|
|
||
|
|
View::share('image', app()->make(ImageService::class));
|
||
|
|
|
||
|
|
$this->publishes([
|
||
|
|
__DIR__ . '/Config/main.php' => config_path('lucent.php'),
|
||
|
|
]);
|
||
|
|
}
|
||
|
|
}
|