paginate($request->query("page", 1)); return Response::detect("washing-reservations.index", [ "reservations" => $reservations]); } /** * Show the form for creating a new resource. * * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\View\View */ public function create() { return Response::detect("washing-reservations.create"); } /** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\View\View */ public function store(Request $request) { $data = $request->validate([ "time" => "required" ]); $machineReservation = new WashingReservation($data); $machineReservation->save(); return Response::detect("washing-reservations.store"); } /** * Display the specified resource. * * @param int $id * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\View\View */ public function show($id) { $machineReservation = WashingReservation::find($id); return Response::detect("washing-reservations.show", [ "machineReservation" => $machineReservation ]); } /** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\View\View */ public function edit($id) { return Response::detect("washing-reservations.edit"); } /** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param int $id * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\View\View */ public function update(Request $request, $id) { $data = $request->validate([ "time" => "required" ]); $machineReservation = WashingReservation::find($id); $machineReservation->update($data); $machineReservation->save(); return Response::detect("washing-reservations.edit", [ "washingReservation" => $machineReservation ]); } /** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\View\View */ public function destroy($id) { $machineReservation = WashingReservation::find($id); $machineReservation->delete(); return Response::detect("washing-reservations.delete"); } }