prodV1 #2

Open
RomanGolienko wants to merge 309 commits from prodV1 into main
3 changed files with 54 additions and 33 deletions
Showing only changes of commit 09b7c8cbe3 - Show all commits

View File

@ -15,20 +15,31 @@ class UpdateFacultyRequest extends FormRequest
{ {
return [ return [
'position' => 'required|int|numeric|max:255', 'position' => 'required|int|numeric|max:255',
'name' => ['required', 'string', 'max:255', "unique:faculties,name,{$this->faculty->id}",],
'description' => 'string', 'description' => 'string',
'slug' => [ 'slug' => ['required', 'string', 'max:255', "unique:faculties,slug,{$this->faculty->id}",],
'required', 'educational_institution_id' => 'required|int|numeric|max:1000',
'string', ];
'max:255', }
"unique:faculties,slug,{$this->faculty->id}",
], public function messages(): array
'educational_institution_id' => 'required|int|numeric|max:255', {
'name' => [ return [
'required', 'position.required' => 'Поле позиция обязательно.',
'string', 'position.int' => 'Позиция должно быть целым числом.',
'max:255', 'position.numeric' => 'Позиция должно быть числом.',
"unique:faculties,name,{$this->faculty->id}", 'position.max' => 'Позиция не должен быть больше :max',
], 'name.required' => 'Поле название обязательно.',
'name.string' => 'Поле название должен быть строкой.',
'name.max' => 'Поле название не должен превышать :max символов.',
'name.unique' => 'Название уже занят.',
'description.string' => 'Поле описание должен быть строкой.',
'slug.string' => 'Поле URL должен быть строкой.',
'slug.max' => 'Поле URL не должен превышать :max символов.',
'educational_institution_id.required' => 'Поле учебное заведение обязательно.',
'educational_institution_id.int' => 'Учебное заведение должно быть целым числом.',
'educational_institution_id.numeric' => 'Учебное заведение должно быть числом.',
'educational_institution_id.max' => 'Поле учебное заведение не должен быть больше :max.',
]; ];
} }
} }

View File

@ -74,7 +74,7 @@
@endif @endif
</div> </div>
<div class="mt-3"> <div class="mt-3">
{{ Form::submit('создать', ['class' => 'btn btn-primary']) }} {{ Form::submit('Создать', ['class' => 'btn btn-primary']) }}
</div> </div>
</div> </div>
{{ Form::close() }} {{ Form::close() }}

View File

@ -1,75 +1,85 @@
@php use App\Helpers\PositionHelper; @endphp
@extends('layouts.admin_layout') @extends('layouts.admin_layout')
@section('content') @section('content')
@auth() @auth()
<div class="row"> <div class="row">
<div class="col"> <div class="col">
<h1 class=""> Создать факультет</h1> <h1 class=""> Редактировать факультет</h1>
{{ Form::open(['url' => route('faculties.update', $faculty), 'method' => 'PATCH', 'class' => '']) }} {{ Form::open(['url' => route('faculties.update', $faculty), 'method' => 'PATCH', 'class' => 'needs-validation', 'novalidate']) }}
<div class="col"> <div class="col">
<div class="mt-3"> <div class="mt-3">
{{ Form::label('position', 'Позиция') }} {{ Form::label('position', 'Позиция', ['data-bs-toggle' => "tooltip", 'data-bs-title' => __('tooltips.faculty.position')]) }}
<span class="text-danger">*</span>
</div> </div>
<div class="mt-1"> <div class="mt-1">
{{ Form::text('position', $faculty->position, ['class' => 'form-control']) }} {{ Form::number('position', $faculty->position, ['class' => 'form-control', 'data-bs-toggle' => "tooltip", 'data-bs-title' => __('tooltips.faculty.position'), 'required']) }}
<div class="invalid-feedback">
Поле "Позиция" обязательно!
</div>
</div> </div>
<div> <div class="text-danger">
@if ($errors->any()) @if ($errors->any())
{{ $errors->first('position') }} {{ $errors->first('position') }}
@endif @endif
</div> </div>
<div class="mt-3"> <div class="mt-3">
{{ Form::label('name', 'Название') }} {{ Form::label('name', 'Название', ['data-bs-toggle' => "tooltip", 'data-bs-title' => __('tooltips.faculty.name')]) }}
<span class="text-danger">*</span>
</div> </div>
<div class="mt-1"> <div class="mt-1">
{{ Form::text('name', $faculty->name, ['class' => 'form-control']) }} {{ Form::text('name', $faculty->name, ['class' => 'form-control', 'data-bs-toggle' => "tooltip", 'data-bs-title' => __('tooltips.faculty.name'), 'required']) }}
<div class="invalid-feedback">
Поле "Название" обязательно!
</div>
</div> </div>
<div> <div class="text-danger">
@if ($errors->any()) @if ($errors->any())
{{ $errors->first('name') }} {{ $errors->first('name') }}
@endif @endif
</div> </div>
<div class="mt-3"> <div class="mt-3">
{{ Form::label('description', 'Описание') }} {{ Form::label('description', 'Описание', ['data-bs-toggle' => "tooltip", 'data-bs-title' => __('tooltips.faculty.description')]) }}
</div> </div>
<div class="mt-1"> <div class="mt-1">
{{ Form::text('description', $faculty->description, ['class' => 'form-control']) }} {{ Form::text('description', $faculty->description, ['class' => 'form-control', 'data-bs-toggle' => "tooltip", 'data-bs-title' => __('tooltips.faculty.description')]) }}
</div> </div>
<div> <div class="text-danger">
@if ($errors->any()) @if ($errors->any())
{{ $errors->first('description') }} {{ $errors->first('description') }}
@endif @endif
</div> </div>
<div class="mt-3"> <div class="mt-3">
{{ Form::label('educational_institution_id', 'Учебное заведение') }} {{ Form::label('educational_institution_id', 'Учебное заведение', ['data-bs-toggle' => "tooltip", 'data-bs-title' => __('tooltips.faculty.educational_institution_id')]) }}
<span class="text-danger">*</span>
</div> </div>
<div class="mt-1"> <div class="mt-1">
{{ Form::select('educational_institution_id', $educationalInstitutions, $faculty->educationalInstitution->id, ['class' => 'form-select']) }} {{ Form::select('educational_institution_id', $educationalInstitutions, $faculty->educationalInstitution->id, ['class' => 'form-select', 'data-bs-toggle' => "tooltip", 'data-bs-title' => __('tooltips.faculty.educational_institution_id')]) }}
</div> </div>
<div> <div class="text-danger">
@if ($errors->any()) @if ($errors->any())
{{ $errors->first('educational_institution_id') }} {{ $errors->first('educational_institution_id') }}
@endif @endif
</div> </div>
<div class="mt-3"> <div class="mt-3">
{{ Form::label('slug', 'URL') }} {{ Form::label('slug', 'URL', ['data-bs-toggle' => "tooltip", 'data-bs-title' => __('tooltips.faculty.slug')]) }}
</div> </div>
<div class="mt-1"> <div class="mt-1">
{{ Form::text('slug', $faculty->slug, ['class' => 'form-control']) }} {{ Form::text('slug', $faculty->slug, ['class' => 'form-control','data-bs-toggle' => "tooltip", 'data-bs-title' => __('tooltips.faculty.slug')]) }}
</div> </div>
<div> <div class="text-danger">
@if ($errors->any()) @if ($errors->any())
{{ $errors->first('slug') }} {{ $errors->first('slug') }}
@endif @endif
</div> </div>
<div class="mt-3"> <div class="mt-3">
{{ Form::submit('создать', ['class' => 'btn btn-primary']) }} {{ Form::submit('Изменить', ['class' => 'btn btn-primary']) }}
</div> </div>
</div> </div>
{{ Form::close() }} {{ Form::close() }}
</div> </div>
</div> </div>
@endauth @endauth
@include('layouts.bootstrap_validation')
@endsection @endsection