protected static function boot() { Poll::creating(function ($poll) { if (empty($poll->slug)) { $poll->slug = $poll->makeSlugFromTitle($poll->title); } return true; }); }