这是我的reportengginerservice.php
public function dataTicketStatuses($month, $year)
{
$datas = TicketStatus::whereHas('ticket', function ($q) use ($year, $month) {
$q->whereHas('division', function ($q2) {
$q2->where('name', 'Engineer');
})->whereYear('created_at', $year)
->whereMonth('created_at', $month)
->where(function ($q4) {
$q4->whereIn('status', ['held', 'done', 'closed']);
});
})
->where(function ($q3) {
$q3->Where('status', 'restarted')->orWhere('status', 'started');
})
->get();
.........................................................................................................
public function get($month, $year)
{
$ticketsStatus = $this->dataTicketStatuses($month, $year);
$ticketItem = [];
$followUp = '';
$isFollowUp = false;
foreach ($ticketsStatus as $key => $ticketSts) {
$ticket = $ticketSts->ticket;
if ($ticketSts->status == 'restarted') {
$isFollowUp = true;
$followUp = ' FollowUp';
} else {
$isFollowUp = false;
$followUp = '';
}
$ticketItem[$key]['time_start'] = $ticketSts->status == 'started' ? Carbon::parse($ticketSts->created_at)->format('H:i') : '';
$ticketItem[$key]['time_restart'] = $ticketSts->status == 'restarted' ? Carbon::parse($ticketSts->created_at)->format('H:i') : '';
$ticketItem[$key]['time_hold'] = $nextStatus->status == 'held' ? Carbon::parse($nextStatus->created_at)->format('H:i') : '';
$ticketItem[$key]['time_end'] = $nextStatus->status=='done' || $nextStatus->status=='closed' ? Carbon::parse($nextStatus->created_at)->format('H:i') : '';
这是我的engginer.blade.php,用于使用数据表从数据库中获取数据
{ "data": "time_start"}, // Time Start
{ "data": "time_restart"}, // Time restarted
{ "data": "time_hold"}, // Time Hold
{ "data": "time_end"},
但是当我运行项目时,没有显示数据时间重新启动和保持的时间,在乔恩刀片视图中,数据时间时间重新启动和时间保持 ,如何重新启动时间和保持时间
获取数据