<?php

namespace App\Components\SoftDelete\Providers;

use Illuminate\Support\ServiceProvider;

class SoftDeleteServiceProvider extends ServiceProvider
{
    /**
     * Register services.
     *
     * @return void
     */
    public function register()
    {
        //
    }

    /**
     * Bootstrap services.
     *
     * @return void
     */
    public function boot()
    {
        // Load routes
        $this->loadRoutesFrom(__DIR__ . '/../routes/web.php');

        // Publish assets
        if ($this->app->runningInConsole()) {
            $this->publishes([
                __DIR__ . '/../resources/js' => public_path('js/soft-delete'),
            ], 'soft-delete-assets');
        }

        // Register blade components
        $this->loadViewsFrom(__DIR__ . '/../resources/views', 'soft-delete');

        // Register the Blade component
        \Illuminate\Support\Facades\Blade::component('soft-delete::components.conflict-modal', 'soft-delete-conflict-modal');
    }
}
