validated(); $place = new Place(); $place->position = $validated['position']; $place->description = $validated['description']; $place->amount = $validated['amount']; $place->education_form_id = $validated['education_form_id']; $place->place_type_id = $validated['place_type_id']; $place->direction_id = $validated['direction_id']; $place->save(); return redirect()->route('places.index'); } public function show(Place $place): View { return view('admin.catalog.direction.place.show', compact('place')); } public function edit(Place $place): View { $directions = Direction::pluck('name', 'id'); $placeTypes = PlaceType::pluck('name', 'id'); $educationForms = EducationForm::pluck('name', 'id'); return view( 'admin.catalog.direction.place.create', compact( 'place', 'directions', 'placeTypes', 'educationForms', ) ); } public function update(UpdatePlaceRequest $request, Place $place): RedirectResponse { $validated = $request->validated(); $place->position = $validated['position']; $place->description = $validated['description']; $place->amount = $validated['amount']; $place->education_form_id = $validated['education_form_id']; $place->place_type_id = $validated['place_type_id']; $place->direction_id = $validated['direction_id']; $place->save(); return redirect()->route('places.index'); } public function destroy(Place $place): RedirectResponse { $place->delete(); return redirect()->route('places.index'); } }