-
The model has trait Sortable After sorting I need to delete the cache \Cache::forget('menu_items'); How can I do it? |
Beta Was this translation helpful? Give feedback.
Answered by
WebVPF
Jul 26, 2023
Replies: 2 comments
-
What about using the model events to look if the class MyModel extends Model {
public $implements = ['Winter.Storm.Database.Traits.Sortable'];
public function afterSave() {
if ($this->wasChanged($this->getSortOrderColumn())
{
\Cache::forget('menu_items');
}
}
} Not a perfect solution since it will be fired many times in a single request though (because many model are saved when reordering) |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
bennothommo
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
#952 (comment)