first&last
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
<?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.
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user