public function getHours() { return round($this->getDuration() / (60 * 60), 2); } /** * Gets the route to the tasks edit action * * @return string */ public function getRoute() { return "/tasks/{$this->public_id}/edit"; } public function getName() { return '#' . $this->public_id; } public function getDisplayName() { if ($this->description) { return mb_strimwidth($this->description, 0, 16, "..."); } return '#' . $this->public_id; } } Task::created(function ($task) { event(new TaskWasCreated($task)); }); Task::updated(function ($task) { event(new TaskWasUpdated($task)); });