1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-20 08:21:34 +02:00
invoiceninja/app/Ninja/Reports/TaskReport.php
2017-08-27 23:18:10 +03:00

37 lines
1007 B
PHP

<?php
namespace App\Ninja\Reports;
use App\Models\Task;
use Utils;
class TaskReport extends AbstractReport
{
public $columns = [
'client',
'date',
'project',
'description',
'duration',
];
public function run()
{
$tasks = Task::scope()
->orderBy('created_at', 'desc')
->with('client.contacts')
->withArchived()
->dateRange($this->startDate, $this->endDate);
foreach ($tasks->get() as $task) {
$this->data[] = [
$task->client ? ($this->isExport ? $task->client->getDisplayName() : $task->client->present()->link) : trans('texts.unassigned'),
$this->isExport ? $task->getStartTime() : link_to($task->present()->url, $task->getStartTime()),
$task->present()->project,
$task->description,
Utils::formatTime($task->getDuration()),
];
}
}
}