You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
1.5 KiB
55 lines
1.5 KiB
<?php
|
|
|
|
namespace authkit2\Providers;
|
|
|
|
use Illuminate\Support\ServiceProvider;
|
|
|
|
class Authkit2ServiceProvider extends ServiceProvider
|
|
{
|
|
|
|
/**
|
|
* Register all providers and other components for any enabled features
|
|
* of the library.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function register(): void
|
|
{
|
|
$this->mergeConfigFrom(__DIR__.'/../../config/authkit.php', 'authkit');
|
|
|
|
if (config('authkit.authn.enable'))
|
|
{
|
|
$this->app->register(AuthnServiceProvider::class);
|
|
}
|
|
|
|
if (config('authkit.authz.enable'))
|
|
{
|
|
$this->app->register(AuthzServiceProvider::class);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Register publishable resources
|
|
*
|
|
* @return void
|
|
*/
|
|
public function boot(): void
|
|
{
|
|
if ($this->app->runningInConsole())
|
|
{
|
|
$this->publishes([
|
|
__DIR__.'/../../config/authkit.php' => config_path('authkit.php')
|
|
], 'authkit2_config');
|
|
|
|
$this->publishes([
|
|
__DIR__.'/../../database/migrations/authkit2_token.php' => database_path('migrations/'.date('Y_m_d_His').'_authkit2_token.php'),
|
|
__DIR__.'/../../database/migrations/new/authkit2_users_update.php' => database_path('migrations/'.date('Y_m_d_His').'_authkit2_fresh_project.php')
|
|
], 'authkit2_migrate_fresh_project');
|
|
$this->publishes([
|
|
__DIR__.'/../../database/migrations/authkit2_token.php' => database_path('migrations/'.date('Y_m_d_His').'_authkit2_token.php'),
|
|
__DIR__.'/../../database/migrations/existing/authkit2_users_update_minimal.php' => database_path('migrations/'.date('Y_m_d_His').'_authkit2_existing_project.php')
|
|
], 'authkit2_migrate_existing_project');
|
|
}
|
|
}
|
|
}
|
|
|
|
|