mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-12-12 01:42:32 +00:00
Replace magic facades
This commit is contained in:
@@ -28,6 +28,7 @@ use FireflyIII\Models\Configuration;
|
||||
use Illuminate\Contracts\Encryption\DecryptException;
|
||||
use Illuminate\Contracts\Encryption\EncryptException;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
/**
|
||||
@@ -38,8 +39,8 @@ class FireflyConfig
|
||||
public function delete(string $name): void
|
||||
{
|
||||
$fullName = 'ff-config-'.$name;
|
||||
if (\Cache::has($fullName)) {
|
||||
\Cache::forget($fullName);
|
||||
if (Cache::has($fullName)) {
|
||||
Cache::forget($fullName);
|
||||
}
|
||||
Configuration::where('name', $name)->forceDelete();
|
||||
}
|
||||
@@ -80,8 +81,8 @@ class FireflyConfig
|
||||
public function get(string $name, mixed $default = null): ?Configuration
|
||||
{
|
||||
$fullName = 'ff-config-'.$name;
|
||||
if (\Cache::has($fullName)) {
|
||||
return \Cache::get($fullName);
|
||||
if (Cache::has($fullName)) {
|
||||
return Cache::get($fullName);
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -92,7 +93,7 @@ class FireflyConfig
|
||||
}
|
||||
|
||||
if (null !== $config) {
|
||||
\Cache::forever($fullName, $config);
|
||||
Cache::forever($fullName, $config);
|
||||
|
||||
return $config;
|
||||
}
|
||||
@@ -122,13 +123,13 @@ class FireflyConfig
|
||||
$item->name = $name;
|
||||
$item->data = $value;
|
||||
$item->save();
|
||||
\Cache::forget('ff-config-'.$name);
|
||||
Cache::forget('ff3-config-'.$name);
|
||||
|
||||
return $item;
|
||||
}
|
||||
$config->data = $value;
|
||||
$config->save();
|
||||
\Cache::forget('ff-config-'.$name);
|
||||
Cache::forget('ff3-config-'.$name);
|
||||
|
||||
return $config;
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ namespace FireflyIII\Support\System;
|
||||
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use Illuminate\Contracts\Encryption\DecryptException;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use Illuminate\Support\Facades\Crypt;
|
||||
use Laravel\Passport\Console\KeysCommand;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
@@ -88,8 +89,8 @@ class OAuthKeys
|
||||
|
||||
public static function generateKeys(): void
|
||||
{
|
||||
\Artisan::registerCommand(new KeysCommand());
|
||||
\Artisan::call('firefly-iii:laravel-passport-keys');
|
||||
Artisan::registerCommand(new KeysCommand());
|
||||
Artisan::call('firefly-iii:laravel-passport-keys');
|
||||
}
|
||||
|
||||
public static function storeKeysInDB(): void
|
||||
|
||||
@@ -247,7 +247,7 @@ class General extends AbstractExtension
|
||||
static function (): string {
|
||||
$args = func_get_args();
|
||||
$route = $args[0]; // name of the route.
|
||||
$name = \Route::getCurrentRoute()->getName() ?? '';
|
||||
$name = Route::getCurrentRoute()->getName() ?? '';
|
||||
if (str_contains($name, $route)) {
|
||||
return 'active';
|
||||
}
|
||||
@@ -271,7 +271,7 @@ class General extends AbstractExtension
|
||||
|
||||
if ($objectType === $activeObjectType
|
||||
&& false !== stripos(
|
||||
(string) \Route::getCurrentRoute()->getName(),
|
||||
(string) Route::getCurrentRoute()->getName(),
|
||||
(string) $route
|
||||
)) {
|
||||
return 'active';
|
||||
@@ -294,7 +294,7 @@ class General extends AbstractExtension
|
||||
static function (): string {
|
||||
$args = func_get_args();
|
||||
$route = $args[0]; // name of the route.
|
||||
$name = \Route::getCurrentRoute()->getName() ?? '';
|
||||
$name = Route::getCurrentRoute()->getName() ?? '';
|
||||
if (str_contains($name, $route)) {
|
||||
return 'menu-open';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user