コード例 #1
0
 public function makeSolved($id)
 {
     try {
         $ticket = Ticket::findOrFail($id);
         $ticket->changeStatus(Ticket::STATUS_SOLVED);
         return redirect('tickets/view/' . $id);
     } catch (ModelNotFoundException $e) {
         Session::flash('error_message', 'The ticket with ID: ' . $id . ' was not found.');
         return redirect('tickets');
     }
 }
コード例 #2
0
 /**
  * Returns tickets with creator.
  *
  * @param $query
  * @param $userId
  * @return mixed
  */
 public function scopeForUser($query, $userId, $ticketStatus)
 {
     return Ticket::with('creator')->where('status', $ticketStatus);
 }