mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
geTaskTimeLogs() helper
This commit is contained in:
parent
892c440ea4
commit
a601702a0e
@ -12,12 +12,16 @@
|
||||
|
||||
namespace App\Services\PdfMaker\Designs\Utilities;
|
||||
|
||||
use App\Models\Task;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use DOMDocument;
|
||||
use DOMXPath;
|
||||
use Exception;
|
||||
|
||||
trait DesignHelpers
|
||||
{
|
||||
use MakesHash;
|
||||
|
||||
public $document;
|
||||
|
||||
public $xpath;
|
||||
@ -219,4 +223,24 @@ trait DesignHelpers
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
public function getTaskTimeLogs(array $row)
|
||||
{
|
||||
if (!array_key_exists('task_id', $row)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$task = Task::find($this->decodePrimaryKey($row['task_id']));
|
||||
|
||||
if (!$task) {
|
||||
return [];
|
||||
}
|
||||
|
||||
foreach (json_decode($task['time_log']) as $log) {
|
||||
info($log);
|
||||
$logs[] = sprintf('%s - %s', \Carbon\Carbon::createFromTimestamp($log[0])->toDateTimeString(), \Carbon\Carbon::createFromTimestamp($log[1])->toDateTimeString());
|
||||
}
|
||||
|
||||
return $logs;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user