Example #1
0
    {
        $parts = json_decode($this->time_log) ?: [];
        $part = $parts[count($parts) - 1];
        if (count($part) == 1 || !$part[1]) {
            return time() - $part[0];
        } else {
            return 0;
        }
    }
    public function hasPreviousDuration()
    {
        $parts = json_decode($this->time_log) ?: [];
        return count($parts) && (count($parts[0]) && $parts[0][1]);
    }
    public function getHours()
    {
        return round($this->getDuration() / (60 * 60), 2);
    }
}
Task::created(function ($task) {
    //Activity::createTask($task);
});
Task::updating(function ($task) {
    //Activity::updateTask($task);
});
Task::deleting(function ($task) {
    //Activity::archiveTask($task);
});
Task::restoring(function ($task) {
    //Activity::restoreTask($task);
});
Example #2
0
    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));
});