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')); }
public function ticket() { return $this->belongsTo(Ticket::getClass()); }
public function destroy($id) { $ticket = Ticket::findOrFail($id); currentUser()->unvote($ticket); return redirect()->back(); }
public function voted() { return $this->belongsToMany(Ticket::getClass(), 'ticket_votes')->withTimestamps(); }