40 lines
937 B
PHP
40 lines
937 B
PHP
<?php
|
|
|
|
namespace App\Providers;
|
|
|
|
use App\Models\Setting;
|
|
use Illuminate\Support\ServiceProvider;
|
|
|
|
class AppServiceProvider extends ServiceProvider
|
|
{
|
|
/**
|
|
* Register any application services.
|
|
*/
|
|
public function register(): void
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Bootstrap any application services.
|
|
*/
|
|
public function boot(): void
|
|
{
|
|
try {
|
|
$companyName = Setting::query()->where('key', 'company_name')->value('value');
|
|
$timezone = Setting::query()->where('key', 'timezone')->value('value');
|
|
|
|
if ($companyName) {
|
|
config(['app.name' => $companyName]);
|
|
}
|
|
|
|
if ($timezone) {
|
|
config(['app.timezone' => $timezone]);
|
|
date_default_timezone_set($timezone);
|
|
}
|
|
} catch (\Throwable) {
|
|
// During initial migration the settings table can be unavailable.
|
|
}
|
|
}
|
|
}
|