/**
  * 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']));
 }
예제 #2
0
 public function populares()
 {
     return Ticket::orderBy('created_at', 'DESC')->paginate();
 }
예제 #3
0
 /**
  * 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();
 }