Exemplo n.º 1
0
 public static function getAtentionsByPetId($id)
 {
     return Atention::where('pet_id', '=', $id);
 }
 public function pdf($id)
 {
     $atention = Atention::find($id);
     $pet = Pet::find($atention->pet_id);
     $age = UtilsController::calculateAge($pet->birth_date);
     $breed = Breed::find($pet->breed_id);
     $specie = Species::find($breed->species_id);
     $client = Client::find($pet->client_id);
     $view = View::make('atention.pdf', compact('atention', 'pet', 'age', 'breed', 'specie', 'client'))->render();
     $pdf = App::make('dompdf.wrapper');
     $pdf->loadHTML($view);
     $nameFile = "Receta-" . $pet->name . "-" . $atention->created_at->format('Y-m-d') . ".pdf";
     return $pdf->download($nameFile);
 }