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());
 }
예제 #4
0
 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();
 }