diff --git a/app/Http/Controllers/TicketController.php b/app/Http/Controllers/TicketController.php index 97630eec..c943e446 100644 --- a/app/Http/Controllers/TicketController.php +++ b/app/Http/Controllers/TicketController.php @@ -21,6 +21,13 @@ class TicketController extends Controller abort(500, '工单不存在'); } $ticket['message'] = TicketMessage::where('ticket_id', $ticket->id)->get(); + for ($i = 0; $i <= count($ticket['message']); $i++) { + if ($ticket['message'][$i]['user_id'] == $request->session()->get('id')) { + $ticket['message'][$i]['is_me'] = true; + } else { + $ticket['message'][$i]['is_me'] = false; + } + } return response([ 'data' => $ticket ]);