diff --git a/app/Facades/Options.php b/app/Facades/Options.php index 6fbd4c0..7506d9a 100644 --- a/app/Facades/Options.php +++ b/app/Facades/Options.php @@ -3,7 +3,17 @@ namespace App\Facades; use \Illuminate\Support\Facades\Facade; +use phpDocumentor\Reflection\Types\Boolean; +/** + * Class Options + * @package App\Facades + * + * @method static void setOption(string $option, string $value, string $description) + * @method static string getOption(string $option) + * @method static void changeOption(string $option, string $newValue) + * @method static Boolean optionExists(string $option) + */ class Options extends Facade { public static function getFacadeAccessor() diff --git a/app/Helpers/Options.php b/app/Helpers/Options.php index 13c416d..3b3c000 100644 --- a/app/Helpers/Options.php +++ b/app/Helpers/Options.php @@ -13,9 +13,12 @@ class Options public function getOption(string $option): string { $value = Cache::get($option); + $fromCache = true; if (is_null($value)) { + $fromCache = false; + Log::debug('Option ' . $option . 'not found in cache, refreshing from database'); $value = Option::where('option_name', $option)->first(); if (is_null($value)) @@ -25,7 +28,9 @@ class Options Cache::put($option . '_desc', 'Undefined description'); } - return $value->option_value; + return (!$fromCache) + ? $value->option_value + : $value; } public function setOption(string $option, string $value, string $description) diff --git a/app/Notifications/NewApplicant.php b/app/Notifications/NewApplicant.php index 0fdbac9..187ba38 100644 --- a/app/Notifications/NewApplicant.php +++ b/app/Notifications/NewApplicant.php @@ -26,7 +26,8 @@ class NewApplicant extends Notification implements ShouldQueue /** * Create a new notification instance. * - * @return void + * @param Application $application + * @param Vacancy $vacancy */ public function __construct(Application $application, Vacancy $vacancy) { diff --git a/app/Options.php b/app/Options.php index e650bbc..74babe3 100644 --- a/app/Options.php +++ b/app/Options.php @@ -8,6 +8,7 @@ class Options extends Model { public $fillable = [ 'option_name', - 'option_value' + 'option_value', + 'friendly_name' ]; } diff --git a/database/seeders/DefaultOptionsSeeder.php b/database/seeders/DefaultOptionsSeeder.php index 1940264..c3d1c1c 100644 --- a/database/seeders/DefaultOptionsSeeder.php +++ b/database/seeders/DefaultOptionsSeeder.php @@ -23,6 +23,7 @@ class DefaultOptionsSeeder extends Seeder Options::setOption('enable_slack_notifications', true, 'Enable slack notifications'); Options::setOption('enable_email_notifications', true, 'Enable e-mail notifications'); + Options::setOption('enable_discord_notifications', true, 'Enable discord notifications'); } }