public function getDoDelete($pets_id) { $pets = \App\Pet::find($pets_id); $pets->delete(); \Session::flash('flash_message', 'Your Pet has been deleted.'); return redirect('/profile'); }
public function show($id) { $pet = Pet::find($id); if (!$pet) { return response()->json(['error' => ['message' => 'Pet not found']], 404); } return response()->json(['data' => $this->transform($pet)], 200); }
public function flyer($pet_id) { // Get this pet $pet = \App\Pet::find($pet_id); // Convert the photo to base64 $pet->photo = base64_encode(file_get_contents($pet->photo)); $pet->photo = "data:image/jpg;base64," . $pet->photo; // Generate the view, passing it `pet` and `user` $html = view('pdfs.missing')->with('pet', $pet)->with('user', \Auth::user())->render(); //return PDF::load($html)->show(); return $html; }
/** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param int $id * @return \Illuminate\Http\Response */ public function update(Request $request, $id) { // $pet = Pet::find($id); $pet->update($request->except('id')); return redirect('/pet'); }