validated(); $period = new Period(); $period->position = $validated['position']; $period->description = $validated['description']; $period->period = $validated['period']; $period->education_form_id = $validated['education_form_id']; $period->direction_id = $validated['direction_id']; $period->save(); return redirect()->route('periods.index'); } public function show(Period $period): View { return view('admin.catalog.direction.period.show', compact('period')); } public function edit(Period $period): View { $directions = Direction::pluck('name', 'id'); $educationForms = EducationForm::pluck('name', 'id'); return view( 'admin.catalog.direction.period.edit', compact( 'period', 'directions', 'educationForms', ) ); } public function update(UpdatePeriodRequest $request, Period $period): RedirectResponse { $validated = $request->validated(); $period->position = $validated['position']; $period->description = $validated['description']; $period->period = $validated['period']; $period->education_form_id = $validated['education_form_id']; $period->direction_id = $validated['direction_id']; $period->save(); return redirect()->route('periods.index'); } public function destroy(Period $period): RedirectResponse { $period->delete(); return redirect()->route('periods.index'); } }