예제 #1
0
 protected function postUpdateProgress($ticketId, $progressId)
 {
     $ticket = Ticket::find($ticketId);
     //Loop through so that if any steps have been skipped we insert them as well.
     for ($i = $ticket->state_id + 1; $i <= (int) $progressId; $i++) {
         Progress::create(['state_id' => $i, 'ticket_id' => $ticketId, 'actioned_by' => Auth::user()->id]);
     }
     //Update the state on the ticket table
     $ticket->state_id = $progressId;
     $ticket->save();
     echo json_encode(['success' => 'true', 'message' => 'Progress updated']);
 }
예제 #2
0
 /**
  * @param Request $request
  * @param Response $response
  * @return Object
  * */
 public function userProgress(Request $request, Response $response)
 {
     if ($request->ajax()) {
         $id = $request->get('id');
         $query = Progress::select(['name', 'alias'])->where('id', '=', $id)->get();
         $param = 'progress';
         return $response->json([$query, $param]);
     }
 }