validated(); $entranceExamination = new EntranceExamination(); $entranceExamination->examination_type_id = $validated['examination_type_id']; $entranceExamination->direction_id = $validated['direction_id']; $entranceExamination->subject_id = $validated['subject_id']; $entranceExamination->scores = $validated['scores']; $entranceExamination->position = $validated['position']; $entranceExamination->subject_type_id = $validated['subject_type_id']; $entranceExamination->save(); Log::channel('app') ->info( 'CREATE вступ. испытания {entranceExamination} - user {user}', [ 'user' => Auth::user()->name, 'entranceExamination' => $entranceExamination->name, 'data' => $validated ] ); return redirect()->route('entrance_examinations.index'); } public function show(EntranceExamination $entranceExamination): View { return view( 'admin.catalog.direction.entrance_examination.show', compact('entranceExamination') ); } public function edit(EntranceExamination $entranceExamination): View { $directions = Direction::pluck('full_name', 'id'); $examination_types = ExaminationType::pluck('name', 'id'); $subjects = Subject::pluck('name', 'id'); $subjectTypes = SubjectType::pluck('name', 'id'); return view( 'admin.catalog.direction.entrance_examination.edit', compact( 'entranceExamination', 'directions', 'examination_types', 'subjects', 'subjectTypes', ) ); } public function update( UpdateEntranceExaminationRequest $request, EntranceExamination $entranceExamination ): RedirectResponse { $validated = $request->validated(); $oldData = $entranceExamination->toArray(); $entranceExamination->examination_type_id = $validated['examination_type_id']; $entranceExamination->direction_id = $validated['direction_id']; $entranceExamination->subject_id = $validated['subject_id']; $entranceExamination->scores = $validated['scores']; $entranceExamination->position = $validated['position']; $entranceExamination->subject_type_id = $validated['subject_type_id']; Log::channel('app') ->warning( 'UPDATE вступ. испытания {entranceExamination} - user {user}', [ 'user' => Auth::user()->name, 'entranceExamination' => $entranceExamination->name, 'oldData' => $oldData, 'newData' => $validated ] ); $entranceExamination->save(); return redirect()->route('entrance_examinations.index'); } public function destroy(EntranceExamination $entranceExamination): RedirectResponse { Log::channel('app') ->critical( 'DELETE вступ. испытания {entranceExamination} - user {user}', [ 'user' => Auth::user()->name, 'entranceExamination' => $entranceExamination->name, 'data' => $entranceExamination->toArray(), ] ); $entranceExamination->delete(); return redirect()->route('entrance_examinations.index'); } }