30 lines
760 B
PHP
30 lines
760 B
PHP
<?php
|
|
|
|
namespace App\Http\Middleware;
|
|
|
|
use Closure;
|
|
use Illuminate\Http\Request;
|
|
use Inertia\Inertia;
|
|
use Illuminate\Support\Facades\File;
|
|
use Illuminate\Support\Facades\Artisan;
|
|
|
|
class ShareGlobalSettings
|
|
{
|
|
/**
|
|
* Handle an incoming request.
|
|
*/
|
|
public function handle(Request $request, Closure $next)
|
|
{
|
|
// Skip during installation
|
|
if (!$request->is('install/*') && !$request->is('update/*') && file_exists(storage_path('installed'))) {
|
|
// Share settings with all Inertia responses
|
|
Inertia::share([
|
|
'globalSettings' => function () {
|
|
return settings(); // Use our helper function
|
|
}
|
|
]);
|
|
}
|
|
|
|
return $next($request);
|
|
}
|
|
} |