stepanenko3 / nova-settings

This Laravel Nova settings tool based on env, using nativ nova fields and resources
MIT License
31 stars 5 forks source link

Can't delete Setting model #7

Closed LorenzoAlu closed 1 year ago

LorenzoAlu commented 1 year ago

You can't delete a model because in ToolServiceProvideer there is this bug:

Event::listen(
            [
                SettingsUpdated::class,
                SettingsDeleted::class,
            ],
             function (SettingsUpdated $event) {
                Cache::forget('settings.' . $event->model->slug . '.' . $event->model->env);
            },
        );

You should remove SettingsUpdated class or add SettingsDeleted in listen callback.

My workaround is ignored listen in EventServiceProvider

/**
 * Class EventServiceProvider.
 */
final class EventServiceProvider extends ServiceProvider
{
    /**
     * Register any events for your application.
     *
     * @return void
     */
    public function boot(): void
    {
        Event::forget(SettingsDeleted::class);
    }
}

PS: you work it's great!!!! :D 👍

stepanenko3 commented 1 year ago

@LorenzoAlu Thanks for your issue I fixed it it release 1.0.5