/** * Show the form for creating a new resource. * * @return Response */ public function nuevo($id, Request $request, Guard $auth) { $this->validate($request, ['comentario' => 'required|max:250', 'link' => 'url']); $comentario = new TicketComentario($request->all()); $comentario->user_id = $auth->id(); $ticket = Ticket::findOrFail($id); $ticket->comentarios()->save($comentario); session()->flash('success', 'Comentario guardado correctamente'); return redirect()->back(); //$comentario = new TicketComentario($request->only(['comentario', 'link'])); }
public function populares() { return Ticket::orderBy('created_at', 'DESC')->paginate(); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function borrar($id, Guard $auth) { $ticket = Ticket::findOrFail($id); $auth->user()->quitarVoto($ticket); return redirect()->back(); }