diff --git a/app/Events/SettingSaved.php b/app/Events/SettingSaved.php deleted file mode 100644 index e8423789b7..0000000000 --- a/app/Events/SettingSaved.php +++ /dev/null @@ -1,20 +0,0 @@ -settings = $settings; - } -} \ No newline at end of file diff --git a/app/Models/Setting.php b/app/Models/Setting.php index 25ddbb6978..11325f0e8a 100755 --- a/app/Models/Setting.php +++ b/app/Models/Setting.php @@ -3,13 +3,11 @@ namespace App\Models; use Parsedown; -use App\Events\SettingSaved; use Illuminate\Support\Facades\App; use Illuminate\Support\Facades\Cache; use Illuminate\Database\Eloquent\Model; use Illuminate\Notifications\Notifiable; use Watson\Validating\ValidatingTrait; -use Schema; use Illuminate\Support\Collection; /** @@ -42,15 +40,6 @@ class Setting extends Model */ protected $injectUniqueIdentifier = true; - /** - * The event map for the model. - * - * @var array - */ - protected $dispatchesEvents = [ - 'saved' => SettingSaved::class, - ]; - /** * Model rules. * diff --git a/app/Observers/AssetObserver.php b/app/Observers/AssetObserver.php index 2a42a26873..b435e9cb68 100644 --- a/app/Observers/AssetObserver.php +++ b/app/Observers/AssetObserver.php @@ -59,6 +59,7 @@ class AssetObserver { if ($settings = Setting::getSettings()) { $settings->increment('next_auto_tag_base'); + $settings->save(); } $logAction = new Actionlog(); diff --git a/app/Observers/SettingObserver.php b/app/Observers/SettingObserver.php new file mode 100644 index 0000000000..eea0240017 --- /dev/null +++ b/app/Observers/SettingObserver.php @@ -0,0 +1,23 @@ + [ + 'App\Listeners\LogSuccessfulLogin', + ], - 'Illuminate\Auth\Events\Login' => [ - 'App\Listeners\LogSuccessfulLogin', - ], - - 'Illuminate\Auth\Events\Failed' => [ - 'App\Listeners\LogFailedLogin', - ], - ]; + 'Illuminate\Auth\Events\Failed' => [ + 'App\Listeners\LogFailedLogin', + ], + ]; /** * The subscriber classes to register. @@ -37,22 +32,4 @@ class EventServiceProvider extends ServiceProvider LogListener::class, CheckoutableListener::class ]; - - /** - * Register any events for your application. - * - * @return void - */ - public function boot() - { - parent::boot(); - - /** - * Clear the LDAP settings cache when the settings model is saved - */ - Event::listen(SettingSaved::class, function () { - Cache::forget(Setting::APP_SETTINGS_KEY); - Cache::forget(Setting::SETUP_CHECK_KEY); - }); - } }