阶段更新

This commit is contained in:
2023-01-12 14:47:38 +08:00
parent 088dd64b2f
commit 5b8901281c
626 changed files with 39326 additions and 12 deletions

View File

@@ -0,0 +1,69 @@
<?php
namespace Modules\Storage\Providers;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\ServiceProvider;
class StorageServiceProvider extends ServiceProvider
{
/**
* @var string $moduleName
*/
protected string $moduleName = 'Storage';
/**
* @var string $moduleNameLower
*/
protected string $moduleNameLower = 'storage';
/**
* Boot the application events.
* @return void
*/
public function boot()
{
$this->loadMigrationsFrom(module_path($this->moduleName, 'Database/Migrations'));
}
/**
* Register the service provider.
* @return void
*/
public function register()
{
$this->registerConfig();
$driver = Config::get('storage.driver');
Config::set('filesystems.default', $driver);
$disks = Config::get('storage.disks');
Config::set('filesystems.disks.' . $driver, data_get($disks, $driver));
$this->app->register(RouteServiceProvider::class);
}
/**
* Register config.
* @return void
*/
protected function registerConfig()
{
$this->publishes([
module_path($this->moduleName, 'Config/config.php') => config_path($this->moduleNameLower . '.php'),
], 'config');
$this->mergeConfigFrom(
module_path($this->moduleName, 'Config/config.php'), $this->moduleNameLower
);
}
/**
* Get the services provided by the provider.
* @return array
*/
public function provides(): array
{
return [];
}
}