<?php

namespace Tricks\Dashboard;

use Illuminate\Support\ServiceProvider;
use Laravel\Nova\Events\ServingNova;
use Laravel\Nova\Nova;

class CardServiceProvider extends ServiceProvider
{
    public function register(): void
    {
        $this->mergeConfigFrom(
            __DIR__.'/../config/nova-dashboard.php', 'nova-dashboard'
        );
    }

    public function boot(): void
    {
        $this->publishes([
            __DIR__.'/../config/nova-dashboard.php' => config_path('nova-dashboard.php'),
        ]);
        Nova::serving(function (ServingNova $event) {
            Nova::script('dashboard', __DIR__.'/../dist/js/dashboard.js');
        });
    }
}
