summaryrefslogtreecommitdiff
path: root/src/ServiceProvider.php
blob: 89645435ca5391c6bce349a33003b89e3f167945 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php

namespace Lightscale\LaralightTables;

use Lightscale\LaralightAssets\Facades\Assets;

use Illuminate\Support\ServiceProvider as ServiceProviderBase;
use Illuminate\Support\Facades\Blade;
use Illuminate\Foundation\Console\AboutCommand;

class ServiceProvider extends ServiceProviderBase
{
    public function register() : void
    {

    }

    public function boot() : void
    {
        AboutCommand::add('Laralight Tables', fn() => [
            'Version' => 'dev'
        ]);

        $ns = Service::NAMESPACE;
        $root = __DIR__ . '/..';
        $viewsPath = "{$root}/resources/views";
        $assetsUri = "vendor/{$ns}";
        $assetsPath = public_path($assetsUri);

        $this->loadViewsFrom($viewsPath, $ns);

        $this->publishes([
            $viewsPath => resource_path("views/vendor/{$ns}"),
        ], Service::NAMESPACE . '-views');

        $this->publishes([
            "{$root}/public" => $assetsPath,
        ], "{$ns}-assets");

        Assets::registerManifest($ns, "{$assetsPath}/assets-manifest.json", $assetsUri);
    }

}