public function submit($id, Request $request, Guard $auth)
 {
     $this->validate($request, ['comment' => 'required|max:250', 'website' => 'url']);
     $comment = new TicketComment($request->all());
     $comment->user_id = $auth->id();
     $ticket = Ticket::findOrfail($id);
     $ticket->comments()->save($comment);
     session()->flash('success', 'Tu comentario fue guardado exitosamente');
     return redirect()->back();
 }
 public function details($id)
 {
     $ticket = Ticket::findOrFail($id);
     return view('tickets/details', compact('ticket'));
 }
示例#3
0
 public function ticket()
 {
     return $this->belongsTo(Ticket::getClass());
 }
 public function destroy($id)
 {
     $ticket = Ticket::findOrFail($id);
     currentUser()->unvote($ticket);
     return redirect()->back();
 }
示例#5
0
 public function voted()
 {
     return $this->belongsToMany(Ticket::getClass(), 'ticket_votes')->withTimestamps();
 }