'required', 'slug' => 'required|regex_match[/^[a-zA-Z0-9\-]{1,191}$/]|is_unique[pages.slug,id,{id}]', 'content' => 'required', ]; protected $validationMessages = []; // Before update because slug or title might change protected $afterInsert = ['clearCache']; protected $beforeUpdate = ['clearCache']; protected $beforeDelete = ['clearCache']; protected function clearCache(array $data) { // Clear the cache of all pages cache()->deleteMatching('page*'); return $data; } }