summaryrefslogtreecommitdiff
path: root/src/AuthLogServiceProvider.php
blob: 2c1e177617ef1972db84be5a8bbe6a2aad2ef6d2 (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
<?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/auth_log.php" => config_path('auth_log.php'),
        ], "{$ns}:config");


        if (config('auth_log.enabled')) {
            Event::subscribe(AuthSubscriber::class);
        }
    }
}