Change Options getter to return a single option

This commit is contained in:
Bubka 2020-04-02 10:40:13 +02:00
parent 8177a8f268
commit fd3d016b80

View File

@ -6,11 +6,11 @@ class Options
{ {
/** /**
* Build a collection of options to apply * Compile both default and user options
* *
* @return Options collection * @return Options collection or a signle
*/ */
public static function get() public static function get($option = null)
{ {
// Get a collection of user saved options // Get a collection of user saved options
$userOptions = \Illuminate\Support\Facades\DB::table('options')->pluck('value', 'key'); $userOptions = \Illuminate\Support\Facades\DB::table('options')->pluck('value', 'key');
@ -32,7 +32,7 @@ public static function get()
// fallback values for every options // fallback values for every options
$options = collect(config('app.options'))->merge($userOptions); $options = collect(config('app.options'))->merge($userOptions);
return $options; return !is_null($option) ? $options[$option] : $options;
} }