provider
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace Lucent;
|
||||
|
||||
use Illuminate\Routing\Router;
|
||||
use Illuminate\Support\Facades\View;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Lucent\Channel\ChannelService;
|
||||
use Lucent\Commands\CompileConfig;
|
||||
use Lucent\Commands\RebuildThumbnails;
|
||||
use Lucent\File\ImageService;
|
||||
|
||||
class LucentServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* 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'),
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user