<?php
namespace App\Domains\Account\Providers;

use Illuminate\Support\ServiceProvider;
use App\Domains\Account\Providers\MiddlewareProvider;
use App\Domains\Account\Handler\AuthAdminCheckAccount;
use App\Domains\Account\Providers\RouteServiceProvider;

class AccountServiceProvider extends ServiceProvider
{
    /**
     * 引导启动任何应用程序服务
     *
     * php artisan make:migration --path=app/Domains/Account/Database/migrations
     *
     * @return void
     */
    public function boot()
    {
        $this->loadMigrationsFrom([realpath(__DIR__ . '/../Database/migrations')]);
        $this->mergeConfigFrom(__DIR__ . '/../config.php', 'domain.account');
    }

    /**
     * 注册一个服务提供者
     *
     * @return void
     */
    public function register()
    {
        $this->app->bind('auth:admin:check:account', function () {
            return new AuthAdminCheckAccount();
        });

        $this->app->tag(['auth:admin:check:account'], 'auth:admin:check');

        $this->app->register(RouteServiceProvider::class);
        $this->app->register(MiddlewareServiceProvider::class);
    }
}
