- Upgrade Filament framework from v3 to v4 - Update all Filament resources and pages for v4 compatibility - Fix test suite to maintain 100% pass rate (321 tests passing) - Add visibility condition for ticket close action (only when not closed) - Update dependencies and build assets for new Filament version - Maintain backward compatibility while leveraging v4 improvements
68 lines
1.8 KiB
PHP
68 lines
1.8 KiB
PHP
<?php
|
|
|
|
namespace App\Providers;
|
|
|
|
use Exception;
|
|
use App\Models\Blog;
|
|
use App\Models\Menu;
|
|
use App\Models\Plan;
|
|
use DB;
|
|
use Illuminate\Support\ServiceProvider;
|
|
use Laravel\Cashier\Cashier;
|
|
|
|
class AppServiceProvider extends ServiceProvider
|
|
{
|
|
/**
|
|
* Register any application services.
|
|
*/
|
|
public function register(): void
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Bootstrap any application services.
|
|
*/
|
|
public function boot(): void
|
|
{
|
|
// Only load application data when not in testing environment
|
|
if (! $this->app->environment('testing')) {
|
|
$this->loadApplicationData();
|
|
}
|
|
|
|
Cashier::calculateTaxes();
|
|
}
|
|
|
|
/**
|
|
* Load application data and cache it.
|
|
*/
|
|
private function loadApplicationData(): void
|
|
{
|
|
try {
|
|
$settings = cache()->remember('app_settings', now()->addHours(6), function () {
|
|
return (array) DB::table('settings')->find(1);
|
|
});
|
|
|
|
$menus = cache()->remember('app_menus', now()->addHours(6), function () {
|
|
return Menu::all();
|
|
});
|
|
|
|
$blogs = cache()->remember('app_blogs', now()->addHours(6), function () {
|
|
return Blog::where('is_published', 1)->get();
|
|
});
|
|
|
|
$plans = cache()->remember('app_plans', now()->addHours(6), function () {
|
|
return Plan::all();
|
|
});
|
|
|
|
config(['app.settings' => (array) $settings]);
|
|
config(['app.menus' => $menus]);
|
|
config(['app.blogs' => $blogs]);
|
|
config(['app.plans' => $plans]);
|
|
} catch (Exception $e) {
|
|
// Fail silently if database is not available
|
|
// This allows the application to boot during migrations and testing
|
|
}
|
|
}
|
|
}
|