This commit is contained in:
root 2019-12-13 16:16:09 +08:00
parent ce3ae071c3
commit 5cb4fcb908

View File

@ -79,6 +79,9 @@ class TicketController extends Controller
if (!$ticket) {
abort(500, '工单不存在');
}
if ($request->session()->get('id') == $this->getLastMessage()->user_id) {
abort(500, '请等待管理员回复');
}
$ticketMessage = TicketMessage::create([
'user_id' => $request->session()->get('id'),
'ticket_id' => $ticket->id,
@ -91,4 +94,10 @@ class TicketController extends Controller
'data' => true
]);
}
private function getLastMessage ($ticketId) {
return TicketMessage::where('ticket_id', $ticketId)
->orderBy('id', 'DESC')
->first();
}
}