public function beforeValidate() { // Generate a URL slug for this model if (!$this->exists && !$this->slug) { $this->slug = Str::slug($this->name); } }