$this->carRepository->getAllCars(), ]); } /** * Show the form for creating a new resource. */ public function create(): View { return view('cars.create'); } /** * Store a newly created resource in storage. */ public function store(CarPostRequest $request): RedirectResponse { $this->carRepository->createCar($request->validated()); return redirect()->route('cars.index'); } /** * Display the specified resource. */ public function show(Car $car): View { return view('cars.show', [ 'car' => $car, ]); } /** * Show the form for editing the specified resource. */ public function edit(Car $car): View { return view('cars.edit', [ 'car' => $car, ]); } /** * Update the specified resource in storage. */ public function update(CarPostRequest $request, Car $car): RedirectResponse { $this->carRepository->updateCar($car, $request->validated()); return redirect()->route('cars.index'); } /** * Remove the specified resource from storage. */ public function destroy(Car $car): RedirectResponse { $this->carRepository->deleteCar($car); return redirect()->route('cars.index'); } }