<?php

namespace Lightscale\LaralightAuthLog;

use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Event;

class AuthLogServiceProvider extends ServiceProvider
{
    public function boot(): void
    {
        $ns = "laralight-auth-log";
        $dir = __DIR__;
        $root = "{$dir}/..";

        $this->publishesMigrations([
            "{$root}/database/migrations" => database_path('migrations', "{$ns}:migrations"),
        ]);

        $this->mergeConfigFrom("$root/config/auth_log.php", 'auth_log');
        $this->publishes([
            "{$root}/config/access_log.php" => config_path('auth_log.php'),
        ], "{$ns}:config");

        Event::subscribe(AuthSubscriber::class);
    }
}