/**
  * Store a newly created resource in storage.
  *
  * @param \Illuminate\Http\Request|\Veterinaria\Http\Controllers\AtentionRequest|\Veterinaria\Http\Requests\AtentionRequest $request
  * @return \Illuminate\Http\Response
  */
 public function store(AtentionRequest $request)
 {
     $atentionsType = AtentionType::find($request['atentions_type_id']);
     $ticket = \Veterinaria\Ticket::all()->last();
     if ($ticket == null) {
         $number = 1;
     } else {
         $number = $ticket->number + 1;
     }
     $canceled = 0;
     Ticket::Create(['number' => $number, 'canceled' => $canceled]);
     $ticket = Ticket::all()->last();
     TicketProduct::Create(['ticket_id' => $ticket->id, 'description' => $atentionsType->description, 'quantity' => 1, 'price' => $atentionsType->price, 'subtotal' => $atentionsType->price]);
     Atention::create(['pet_id' => $request['pet_id'], 'atentions_type_id' => $request['atentions_type_id'], 'procedure' => $request['procedure'], 'treatment' => $request['treatment'], 'diagnosis' => $request['diagnosis'], 'prescription' => $request['prescription'], 'ticket_id' => $ticket->id]);
     Session::flash('message', 'La atención fue creada correctamente');
     return Redirect::to('atention/' . $request['pet_id'] . '/index');
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $atentionType = AtentionType::find($id);
     $atentionType->delete();
     Session::flash('message', 'Tipo de atención eliminado correctamente');
     return Redirect::to('/atentionType');
 }