From b016f2ebf1050ff5b42e1ff6329151e12b6c155d Mon Sep 17 00:00:00 2001 From: FreeScout Date: Fri, 14 Sep 2018 11:43:19 -0700 Subject: [PATCH] Spread the Word option in Settings --- app/Http/Controllers/SettingsController.php | 1 + app/Option.php | 21 +++++++++++++++---- .../conversations_table.blade.php | 2 +- .../emails/customer/auto_reply.blade.php | 5 +++++ .../emails/customer/auto_reply_text.blade.php | 7 ++++++- .../emails/customer/reply_fancy.blade.php | 9 +++++++- .../customer/reply_fancy_text.blade.php | 6 +++++- resources/views/settings/general.blade.php | 19 +++++++++++++++++ 8 files changed, 62 insertions(+), 8 deletions(-) diff --git a/app/Http/Controllers/SettingsController.php b/app/Http/Controllers/SettingsController.php index 6290d6ab..115c3d42 100644 --- a/app/Http/Controllers/SettingsController.php +++ b/app/Http/Controllers/SettingsController.php @@ -93,6 +93,7 @@ class SettingsController extends Controller 'company_name' => Option::get('company_name', \Config::get('app.name')), 'next_ticket' => Option::get('next_ticket'), 'user_permissions' => Option::get('user_permissions', []), + 'email_branding' => Option::get('email_branding'), 'open_tracking' => Option::get('open_tracking'), 'enrich_customer_data' => Option::get('enrich_customer_data'), 'time_format' => Option::get('time_format', User::TIME_FORMAT_24), diff --git a/app/Option.php b/app/Option.php index 308d501a..b9ae0fef 100644 --- a/app/Option.php +++ b/app/Option.php @@ -8,6 +8,9 @@ use Illuminate\Database\Eloquent\Model; class Option extends Model { + // todo: cache in file (see WordPress) + public static $cache = []; + public $timestamps = false; /** @@ -62,18 +65,28 @@ class Option extends Model * @param string $name * @return string */ - public static function get($name, $default = false, $decode = true) + public static function get($name, $default = false, $decode = true, $cache = false) { + if ($cache && isset(self::$cache[$name])) { + return self::$cache[$name]; + } + $option = Option::where('name', (string)$name)->first(); if ($option) { if ($decode) { - return self::maybeUnserialize($option->value); + $value = self::maybeUnserialize($option->value); } else { - return $option->value; + $value = $option->value; } } else { - return $default; + $value = $default; } + + if ($cache) { + self::$cache[$name] = $value; + } + + return $value; } public static function remove($name) diff --git a/resources/views/conversations/conversations_table.blade.php b/resources/views/conversations/conversations_table.blade.php index 771887d6..9b21e0f0 100644 --- a/resources/views/conversations/conversations_table.blade.php +++ b/resources/views/conversations/conversations_table.blade.php @@ -39,7 +39,7 @@ {{ __("Conversation") }} @if ($folder->type == App\Folder::TYPE_ASSIGNED || $folder->type == App\Folder::TYPE_CLOSED) - + {{ __("Assigned To") }}