Compare commits
No commits in common. "f3c98e1548bdf3579917a9327fa1ab50367c348d" and "4cb1422b09bce35e73ceb4296533c2518dbdf771" have entirely different histories.
f3c98e1548
...
4cb1422b09
|
@ -9,8 +9,6 @@ use App\Models\EducationalInstitution;
|
|||
use Illuminate\Contracts\View\Factory;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Foundation\Application;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class EducationalInstitutionController extends Controller
|
||||
{
|
||||
|
@ -36,16 +34,6 @@ class EducationalInstitutionController extends Controller
|
|||
$educationalInstitution->position = $validated['position'];
|
||||
$educationalInstitution->save();
|
||||
|
||||
Log::channel('app')
|
||||
->info(
|
||||
'CREATE учеб. заведение {educationalInstitution} - user {user}',
|
||||
[
|
||||
'user' => Auth::user()->name,
|
||||
'educationalInstitution' => $educationalInstitution->name,
|
||||
'data' => $validated
|
||||
]
|
||||
);
|
||||
|
||||
return redirect()->route('educational_institutions.index');
|
||||
}
|
||||
|
||||
|
@ -62,24 +50,11 @@ class EducationalInstitutionController extends Controller
|
|||
public function update(UpdateEducationalInstitutionRequest $request, EducationalInstitution $educationalInstitution)
|
||||
{
|
||||
$validated = $request->validated();
|
||||
$oldData = $educationalInstitution->toArray();
|
||||
|
||||
$educationalInstitution->name = $validated['name'];
|
||||
$educationalInstitution->description = $validated['description'];
|
||||
$educationalInstitution->position = $validated['position'];
|
||||
$educationalInstitution->slug = $validated['slug'];
|
||||
|
||||
Log::channel('app')
|
||||
->warning(
|
||||
'UPDATE учеб. заведение {educationalInstitution} - user {user}',
|
||||
[
|
||||
'user' => Auth::user()->name,
|
||||
'faculty' => $educationalInstitution->name,
|
||||
'oldData' => $oldData,
|
||||
'newData' => $validated
|
||||
]
|
||||
);
|
||||
|
||||
$educationalInstitution->save();
|
||||
|
||||
return redirect()->route('educational_institutions.index');
|
||||
|
@ -88,26 +63,8 @@ class EducationalInstitutionController extends Controller
|
|||
public function destroy(EducationalInstitution $educationalInstitution)
|
||||
{
|
||||
if ($educationalInstitution->faculties()->exists()) {
|
||||
Log::channel('app')
|
||||
->error(
|
||||
'NOT DELETE учеб. заведение {educationalInstitution} - user {user}',
|
||||
[
|
||||
'user' => Auth::user()->name,
|
||||
'educationalInstitution' => $educationalInstitution->name,
|
||||
'data' => $educationalInstitution->toArray(),
|
||||
]
|
||||
);
|
||||
return back();
|
||||
}
|
||||
Log::channel('app')
|
||||
->critical(
|
||||
'DELETE учеб. заведение {educationalInstitution} - user {user}',
|
||||
[
|
||||
'user' => Auth::user()->name,
|
||||
'educationalInstitution' => $educationalInstitution->name,
|
||||
'data' => $educationalInstitution->toArray(),
|
||||
]
|
||||
);
|
||||
$educationalInstitution->delete();
|
||||
|
||||
return redirect()->route('educational_institutions.index');
|
||||
|
|
|
@ -16,24 +16,8 @@ class StoreEducationalInstitutionRequest extends FormRequest
|
|||
return [
|
||||
'position' => 'required|int|numeric|max:255',
|
||||
'name' => 'required|string|max:255|unique:educational_institutions,name',
|
||||
'description' => 'nullable|string',
|
||||
'slug' => 'nullable|string|max:255|unique:educational_institutions,slug',
|
||||
];
|
||||
}
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'position.required' => 'Поле позиция обязательно.',
|
||||
'position.int' => 'Позиция должно быть целым числом.',
|
||||
'position.numeric' => 'Позиция должно быть числом.',
|
||||
'position.max' => 'Позиция не должен быть больше :max',
|
||||
'name.required' => 'Поле название обязательно.',
|
||||
'name.string' => 'Поле название должен быть строкой.',
|
||||
'name.max' => 'Поле название не должен превышать :max символов.',
|
||||
'name.unique' => 'Название уже занят.',
|
||||
'description.string' => 'Поле описание должен быть строкой.',
|
||||
'slug.string' => 'Поле URL должен быть строкой.',
|
||||
'slug.max' => 'Поле URL не должен превышать :max символов.',
|
||||
'description' => 'string',
|
||||
'slug' => 'required|string|max:255|unique:educational_institutions,slug',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ class UpdateEducationalInstitutionRequest extends FormRequest
|
|||
{
|
||||
return [
|
||||
'position' => 'required|int|numeric|max:255',
|
||||
'description' => 'nullable|string',
|
||||
'description' => 'string',
|
||||
'slug' => [
|
||||
'required',
|
||||
'string',
|
||||
|
@ -31,21 +31,4 @@ class UpdateEducationalInstitutionRequest extends FormRequest
|
|||
],
|
||||
];
|
||||
}
|
||||
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'position.required' => 'Поле позиция обязательно.',
|
||||
'position.int' => 'Позиция должно быть целым числом.',
|
||||
'position.numeric' => 'Позиция должно быть числом.',
|
||||
'position.max' => 'Позиция не должен быть больше :max',
|
||||
'name.required' => 'Поле название обязательно.',
|
||||
'name.string' => 'Поле название должен быть строкой.',
|
||||
'name.max' => 'Поле название не должен превышать :max символов.',
|
||||
'name.unique' => 'Название уже занят.',
|
||||
'description.string' => 'Поле описание должен быть строкой.',
|
||||
'slug.string' => 'Поле URL должен быть строкой.',
|
||||
'slug.max' => 'Поле URL не должен превышать :max символов.',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
<span class="text-danger">*</span>
|
||||
</div>
|
||||
<div class="mt-2">
|
||||
{{ Form::number('name', '', ['class' => 'form-control', 'data-bs-toggle' => "tooltip", 'data-bs-title' => __('tooltips.educational_institutions.name'), 'required']) }}
|
||||
{{ Form::text('name', '', ['class' => 'form-control', 'data-bs-toggle' => "tooltip", 'data-bs-title' => __('tooltips.educational_institutions.name'), 'required']) }}
|
||||
<div class="invalid-feedback">
|
||||
Поле "Название" обязательно!
|
||||
</div>
|
||||
|
|
|
@ -4,58 +4,50 @@
|
|||
<div class="row">
|
||||
<div class="col">
|
||||
<h1 class="">Изменить учебное заведение</h1>
|
||||
{{ Form::model($educationalInstitution, ['route' => ['educational_institutions.update', $educationalInstitution], 'method' => 'PATCH', 'class' => 'needs-validation', 'novalidate']) }}
|
||||
{{ Form::model($educationalInstitution, ['route' => ['educational_institutions.update', $educationalInstitution], 'method' => 'PATCH', 'class' => '']) }}
|
||||
<div class="col">
|
||||
<div>
|
||||
{{ Form::label('position', 'Позиция') }}
|
||||
</div>
|
||||
<div class="mt-2">
|
||||
{{ Form::label('position', 'Позиция', ['data-bs-toggle' => "tooltip", 'data-bs-title' => __('tooltips.educational_institutions.position')]) }}
|
||||
<span class="text-danger">*</span>
|
||||
{{ Form::text('position', $educationalInstitution->position, ['class' => 'form-control']) }}
|
||||
</div>
|
||||
<div class="mt-1">
|
||||
{{ Form::number('position', $educationalInstitution->position, ['class' => 'form-control', 'data-bs-toggle' => "tooltip", 'data-bs-title' => __('tooltips.educational_institutions.position'), 'required']) }}
|
||||
<div class="invalid-feedback">
|
||||
Поле "Позиция" обязательно!
|
||||
</div>
|
||||
</div>
|
||||
<div class="text-danger">
|
||||
<div>
|
||||
@if ($errors->any())
|
||||
{{ $errors->first('position') }}
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<div>
|
||||
{{ Form::label('name', 'Название') }}
|
||||
</div>
|
||||
<div class="mt-2">
|
||||
{{ Form::label('name', 'Название', ['data-bs-toggle' => "tooltip", 'data-bs-title' => __('tooltips.educational_institutions.name')]) }}
|
||||
<span class="text-danger">*</span>
|
||||
{{ Form::text('name', $educationalInstitution->name, ['class' => 'form-control']) }}
|
||||
</div>
|
||||
<div class="mt-1">
|
||||
{{ Form::text('name', $educationalInstitution->name, ['class' => 'form-control', 'data-bs-toggle' => "tooltip", 'data-bs-title' => __('tooltips.educational_institutions.name'), 'required']) }}
|
||||
<div class="invalid-feedback">
|
||||
Поле "Название" обязательно!
|
||||
</div>
|
||||
</div>
|
||||
<div class="text-danger">
|
||||
<div>
|
||||
@if ($errors->any())
|
||||
{{ $errors->first('name') }}
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<div>
|
||||
{{ Form::label('description', 'Описание') }}
|
||||
</div>
|
||||
<div class="mt-2">
|
||||
{{ Form::label('description', 'Описание', ['data-bs-toggle' => "tooltip", 'data-bs-title' => __('tooltips.educational_institutions.description')]) }}
|
||||
{{ Form::text('description', $educationalInstitution->description, ['class' => 'form-control']) }}
|
||||
</div>
|
||||
<div class="mt-1">
|
||||
{{ Form::text('description', $educationalInstitution->description, ['class' => 'form-control', 'data-bs-toggle' => "tooltip", 'data-bs-title' => __('tooltips.educational_institutions.description')]) }}
|
||||
</div>
|
||||
<div class="text-danger">
|
||||
<div>
|
||||
@if ($errors->any())
|
||||
{{ $errors->first('description') }}
|
||||
@endif
|
||||
</div>
|
||||
<div class="mt-2">
|
||||
{{ Form::label('slug', 'URL', ['data-bs-toggle' => "tooltip", 'data-bs-title' => __('tooltips.educational_institutions.slug')]) }}
|
||||
<div class="mt-3">
|
||||
{{ Form::label('slug', 'URL') }}
|
||||
</div>
|
||||
<div class="mt-1">
|
||||
{{ Form::text('slug', $educationalInstitution->slug, ['class' => 'form-control', 'data-bs-toggle' => "tooltip", 'data-bs-title' => __('tooltips.educational_institutions.slug')]) }}
|
||||
{{ Form::text('slug', $educationalInstitution->slug, ['class' => 'form-control']) }}
|
||||
</div>
|
||||
<div class="text-danger">
|
||||
<div>
|
||||
@if ($errors->any())
|
||||
{{ $errors->first('slug') }}
|
||||
@endif
|
||||
|
|
Loading…
Reference in New Issue