string('app.filament_path'); abort_if(! $path, 500, 'Filament path missing'); return $path; } /** * Temprory cache for single request * * @return ($key is '' ? CacheRepository : mixed) */ function temp_cache(string $key = ''): mixed { $tempCache = cache()->driver('array'); return ($key === '') ? $tempCache : $tempCache->get($key); } /** * Log */ function logDB(): void { if (! app()->isLocal()) { return; } DB::listen(function ($query) { Log::info($query->sql, $query->bindings, $query->time); }); } /** * User */ function user(): User { abort_unless(Auth::check(), 401, 'Unauthorized'); /** @var \App\Models\User */ $user = Auth::user(); return $user; }