/** * delete rental * @param $id * @return \Illuminate\Http\JsonResponse */ public function delete($id) { $rental = Rental::find($id); if ($rental == null) { return response()->json("Rental data not found"); } $rental->delete(); return response()->json("Rental data deleted"); }
/** * @param $id * @return \Illuminate\Http\RedirectResponse */ public function delete($id) { Rental::find($id)->delete(); return redirect()->route('bus_request'); }
public function receipt($id) { if (Auth::check()) { $rental = Rental::find($id); $car = Car::find($rental->car_id); return view('history.receipt', compact('rental', 'car')); } else { return Redirect::to('/'); } }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { // $rental = \App\Rental::find($id); if ($rental->delete()) { return response()->json(['rentals' => [$rental]], 201); } else { return response()->json(['success' => false], 401); } }