2023-11-17 14:44:01 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Providers;
|
|
|
|
|
|
|
|
|
|
use App\Support\Setting;
|
2026-03-15 09:49:11 +08:00
|
|
|
use Illuminate\Support\Facades\URL;
|
2023-11-17 14:44:01 +08:00
|
|
|
use Illuminate\Support\ServiceProvider;
|
2024-04-10 00:51:03 +08:00
|
|
|
use Illuminate\Contracts\Foundation\Application;
|
2025-07-04 22:16:19 +08:00
|
|
|
use Illuminate\Support\Facades\Log;
|
2023-11-17 14:44:01 +08:00
|
|
|
|
|
|
|
|
class SettingServiceProvider extends ServiceProvider
|
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* Register services.
|
|
|
|
|
*
|
|
|
|
|
* @return void
|
|
|
|
|
*/
|
|
|
|
|
public function register()
|
|
|
|
|
{
|
2025-01-21 14:57:54 +08:00
|
|
|
$this->app->scoped(Setting::class, function (Application $app) {
|
2025-07-04 22:16:19 +08:00
|
|
|
return new Setting();
|
2023-11-17 14:44:01 +08:00
|
|
|
});
|
2024-04-10 00:51:03 +08:00
|
|
|
|
2023-11-17 14:44:01 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Bootstrap services.
|
|
|
|
|
*
|
|
|
|
|
* @return void
|
|
|
|
|
*/
|
|
|
|
|
public function boot()
|
|
|
|
|
{
|
2026-03-15 09:49:11 +08:00
|
|
|
if ($appUrl = admin_setting('app_url')) {
|
|
|
|
|
URL::forceRootUrl($appUrl);
|
|
|
|
|
}
|
2023-11-17 14:44:01 +08:00
|
|
|
}
|
|
|
|
|
}
|