changes
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Containers\Dashboard\UI\WEB\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class AttachDepartmentProgramRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'program_id' => ['required', 'exists:educational_programs,id'],
|
||||
];
|
||||
}
|
||||
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'program_id.required' => 'Необходимо выбрать образовательную программу',
|
||||
'program_id.exists' => 'Выбранная программа не существует',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Containers\Dashboard\UI\WEB\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class AttachDepartmentTeacherRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'user_id' => ['required', 'exists:users,id'],
|
||||
'teaching_position' => ['required', 'string', 'max:255'],
|
||||
'service_email' => ['nullable', 'email', 'max:255'],
|
||||
'service_phone' => ['nullable', 'string', 'max:20'],
|
||||
'cabinet' => ['nullable', 'string', 'max:10'],
|
||||
];
|
||||
}
|
||||
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'user_id.required' => 'Необходимо выбрать преподавателя',
|
||||
'user_id.exists' => 'Выбранный преподаватель не существует',
|
||||
'teaching_position.required' => 'Должность обязательна для заполнения',
|
||||
'teaching_position.max' => 'Должность не должна превышать 255 символов',
|
||||
'service_email.email' => 'Введите корректный email адрес',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Containers\Dashboard\UI\WEB\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class AttachDepartmentWorkerRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'user_id' => ['required', 'exists:users,id'],
|
||||
'position' => ['required', 'string', 'max:255'],
|
||||
'service_email' => ['nullable', 'email', 'max:255'],
|
||||
'service_phone' => ['nullable', 'string', 'max:20'],
|
||||
'cabinet' => ['nullable', 'string', 'max:10'],
|
||||
];
|
||||
}
|
||||
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'user_id.required' => 'Необходимо выбрать сотрудника',
|
||||
'user_id.exists' => 'Выбранный сотрудник не существует',
|
||||
'position.required' => 'Должность обязательна для заполнения',
|
||||
'position.max' => 'Должность не должна превышать 255 символов',
|
||||
'service_email.email' => 'Введите корректный email адрес',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Containers\Dashboard\UI\WEB\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class AttachDivisionWorkerRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'user_id' => ['required', 'exists:users,id'],
|
||||
'administrativePosition' => ['required', 'string', 'max:255'],
|
||||
'service_email' => ['nullable', 'email', 'max:255'],
|
||||
'service_phone' => ['nullable', 'string', 'max:20'],
|
||||
'cabinet' => ['nullable', 'string', 'max:10'],
|
||||
];
|
||||
}
|
||||
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'user_id.required' => 'Необходимо выбрать сотрудника',
|
||||
'user_id.exists' => 'Выбранный сотрудник не существует',
|
||||
'administrativePosition.required' => 'Административная должность обязательна для заполнения',
|
||||
'administrativePosition.max' => 'Должность не должна превышать 255 символов',
|
||||
'service_email.email' => 'Некорректный email адрес',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Containers\Dashboard\UI\WEB\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class AttachFacultyWorkerRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'user_id' => ['required', 'exists:users,id'],
|
||||
'position' => ['required', 'string', 'max:255'],
|
||||
'service_email' => ['nullable', 'email', 'max:255'],
|
||||
'service_phone' => ['nullable', 'string', 'max:20'],
|
||||
'cabinet' => ['nullable', 'string', 'max:10'],
|
||||
];
|
||||
}
|
||||
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'user_id.required' => 'Необходимо выбрать сотрудника',
|
||||
'user_id.exists' => 'Выбранный сотрудник не существует',
|
||||
'position.required' => 'Должность обязательна для заполнения',
|
||||
'position.max' => 'Должность не должна превышать 255 символов',
|
||||
'service_email.email' => 'Некорректный email адрес',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
<?php
|
||||
|
||||
namespace App\Containers\Dashboard\UI\WEB\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class StoreAcademicJournalRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'title' => ['required', 'string', 'max:255'],
|
||||
'slug' => ['required', 'string', 'max:255', 'unique:academic_journals,slug'],
|
||||
'main_info' => ['nullable', 'array'],
|
||||
'chief_editor' => ['nullable', 'array'],
|
||||
'editors' => ['nullable', 'array'],
|
||||
'for_authors' => ['nullable', 'array'],
|
||||
];
|
||||
}
|
||||
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'title.required' => 'Название журнала обязательно для заполнения',
|
||||
'title.max' => 'Название журнала не должно превышать 255 символов',
|
||||
'slug.required' => 'URL-адрес обязателен для заполнения',
|
||||
'slug.unique' => 'Журнал с таким URL-адресом уже существует',
|
||||
];
|
||||
}
|
||||
|
||||
protected function prepareForValidation(): void
|
||||
{
|
||||
// Автоматическая генерация slug если не передан
|
||||
if (empty($this->slug) && !empty($this->title)) {
|
||||
$this->merge([
|
||||
'slug' => Str::slug($this->title),
|
||||
]);
|
||||
}
|
||||
|
||||
// Генерация search_data из main_info
|
||||
if (!empty($this->main_info)) {
|
||||
$this->merge([
|
||||
'search_data' => $this->generateSearchData($this->main_info),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
private function generateSearchData(array $data): string
|
||||
{
|
||||
$parts = [];
|
||||
foreach ($data as $block) {
|
||||
$parts[] = $this->getDataFromBlocks($block);
|
||||
}
|
||||
$result = implode(' ', $parts);
|
||||
$result = preg_replace('/\s+/', ' ', $result);
|
||||
$result = trim($result);
|
||||
|
||||
return strtolower($result);
|
||||
}
|
||||
|
||||
private function getDataFromBlocks($block): string
|
||||
{
|
||||
$data = '';
|
||||
switch ($block['type']) {
|
||||
case 'paragraph':
|
||||
$data .= strip_tags($block['data']['content']) . ' ';
|
||||
break;
|
||||
case 'heading':
|
||||
$data .= strip_tags($block['data']['content']) . ' ';
|
||||
break;
|
||||
case 'files':
|
||||
foreach ($block['data']['file'] as $file) {
|
||||
$data .= $file['title'] . ' ';
|
||||
}
|
||||
break;
|
||||
case 'person':
|
||||
$data .= $block['data']['name'] . ' ';
|
||||
break;
|
||||
case 'stepper':
|
||||
$data .= $block['data']['step_name'] . ' ';
|
||||
foreach ($block['data']['steps'] as $step) {
|
||||
$data .= $step['title'] . ' ';
|
||||
$data .= strip_tags($step['content']) . ' ';
|
||||
}
|
||||
break;
|
||||
case 'tabs':
|
||||
foreach ($block['data']['tab'] as $item) {
|
||||
foreach ($item['content'] as $blockItem) {
|
||||
$data .= $this->getDataFromBlocks($blockItem);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace App\Containers\Dashboard\UI\WEB\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class StoreAdditionalEducationRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'title' => ['required', 'string', 'max:255'],
|
||||
'slug' => ['required', 'string', 'max:255', 'unique:additional_educations,slug'],
|
||||
'category_id' => ['required', 'exists:additional_education_categories,id'],
|
||||
'target_group' => ['required', 'string', 'max:255'],
|
||||
'qualification' => ['nullable', 'string', 'max:255'],
|
||||
'price' => ['required', 'numeric', 'min:0'],
|
||||
'learning_time' => ['required', 'integer', 'min:1'],
|
||||
'form_education' => ['required', 'integer', 'in:1,2,3'],
|
||||
'is_active' => ['boolean'],
|
||||
'content' => ['nullable', 'array'],
|
||||
];
|
||||
}
|
||||
|
||||
public function attributes(): array
|
||||
{
|
||||
return [
|
||||
'title' => 'название программы',
|
||||
'slug' => 'URL-адрес',
|
||||
'category_id' => 'категория',
|
||||
'target_group' => 'целевая аудитория',
|
||||
'qualification' => 'выдаваемый документ',
|
||||
'price' => 'стоимость',
|
||||
'learning_time' => 'объем (часов)',
|
||||
'form_education' => 'форма обучения',
|
||||
'is_active' => 'статус активности',
|
||||
'content' => 'содержание программы',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace App\Containers\Dashboard\UI\WEB\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class StoreAdmissionCampaignRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'name' => ['required', 'string', 'max:255'],
|
||||
'academic_year' => ['required', 'string', 'max:20'],
|
||||
'status' => ['required', 'integer', 'in:1,2,3'],
|
||||
'info' => ['nullable', 'array'],
|
||||
'info.*.edu_name' => ['required_with:info', 'integer'],
|
||||
'info.*.total_programs' => ['required_with:info', 'integer', 'min:0'],
|
||||
'info.*.och_count' => ['required_with:info', 'integer', 'min:0'],
|
||||
'info.*.zaoch_count' => ['required_with:info', 'integer', 'min:0'],
|
||||
'info.*.budget_places' => ['required_with:info', 'integer', 'min:0'],
|
||||
'info.*.non_budget_places' => ['required_with:info', 'integer', 'min:0'],
|
||||
];
|
||||
}
|
||||
|
||||
public function attributes(): array
|
||||
{
|
||||
return [
|
||||
'name' => 'название кампании',
|
||||
'academic_year' => 'академический год',
|
||||
'status' => 'статус кампании',
|
||||
'info' => 'информация о наборе',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace App\Containers\Dashboard\UI\WEB\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class StoreAdmissionPlanRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'educational_programs_id' => ['required', 'exists:educational_programs,id'],
|
||||
'admission_campaigns_id' => ['required', 'exists:admission_campaigns,id'],
|
||||
'exams' => ['nullable', 'array'],
|
||||
'exams.*.title' => ['required_with:exams', 'string', 'max:100'],
|
||||
'exams.*.priority' => ['required_with:exams', 'integer', 'min:0'],
|
||||
'exams.*.types' => ['nullable', 'array'],
|
||||
'exams.*.types.*.type' => ['required_with:exams.*.types', 'integer'],
|
||||
'exams.*.types.*.min_ball' => ['required_with:exams.*.types', 'integer', 'min:0', 'max:100'],
|
||||
'contests' => ['nullable', 'array'],
|
||||
'contests.*.form_education' => ['required_with:contests', 'integer'],
|
||||
'contests.*.places.form_budget' => ['required_with:contests', 'integer'],
|
||||
'contests.*.places.count' => ['required_with:contests', 'integer', 'min:0'],
|
||||
];
|
||||
}
|
||||
|
||||
public function attributes(): array
|
||||
{
|
||||
return [
|
||||
'educational_programs_id' => 'образовательная программа',
|
||||
'admission_campaigns_id' => 'приемная кампания',
|
||||
'exams' => 'вступительные испытания',
|
||||
'contests' => 'условия поступления',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Containers\Dashboard\UI\WEB\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class StoreCategoryRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'title' => ['required', 'string', 'max:255'],
|
||||
'slug' => ['required', 'string', 'max:255', 'unique:additional_education_categories,slug'],
|
||||
'dir_addit_educat_id' => ['required', 'exists:direction_additional_educations,id'],
|
||||
'is_active' => ['boolean'],
|
||||
];
|
||||
}
|
||||
|
||||
public function attributes(): array
|
||||
{
|
||||
return [
|
||||
'title' => 'название категории',
|
||||
'slug' => 'URL-идентификатор',
|
||||
'dir_addit_educat_id' => 'направление ДПО',
|
||||
'is_active' => 'статус активности',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace App\Containers\Dashboard\UI\WEB\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class StoreContactWidgetRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'title' => ['required', 'string', 'max:255'],
|
||||
'slug' => ['required', 'string', 'max:255', Rule::unique('contact_widgets', 'slug')],
|
||||
'is_active' => ['boolean'],
|
||||
'content' => ['required', 'array', 'min:1'],
|
||||
'content.*.title' => ['required', 'string', 'max:255'],
|
||||
'content.*.items' => ['required', 'array', 'min:1'],
|
||||
'content.*.items.*.header' => ['required', 'string', 'max:255'],
|
||||
'content.*.items.*.details' => ['nullable', 'array'],
|
||||
'content.*.items.*.details.*.content' => ['required', 'string'],
|
||||
'content.*.items.*.details.*.url' => ['nullable', 'url'],
|
||||
];
|
||||
}
|
||||
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'title.required' => 'Название ресурса обязательно для заполнения',
|
||||
'title.max' => 'Название не должно превышать 255 символов',
|
||||
'slug.required' => 'URL-адрес обязателен',
|
||||
'slug.unique' => 'Такой URL-адрес уже используется',
|
||||
'slug.max' => 'URL-адрес не должен превышать 255 символов',
|
||||
'content.required' => 'Содержание обязательно для заполнения',
|
||||
'content.*.title.required' => 'Заголовок столбца обязателен',
|
||||
'content.*.items.required' => 'Добавьте хотя бы один контактный блок',
|
||||
'content.*.items.*.header.required' => 'Заголовок контакта обязателен',
|
||||
'content.*.items.*.details.*.content.required' => 'Значение контакта обязательно',
|
||||
'content.*.items.*.details.*.url.url' => 'Укажите корректный URL',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace App\Containers\Dashboard\UI\WEB\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class StoreCustomFormRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'title' => ['required', 'string', 'max:255'],
|
||||
'form_id' => ['required', 'string', 'max:255', Rule::unique('custom_forms', 'form_id')],
|
||||
'description' => ['required', 'string', 'max:2000'],
|
||||
'status' => ['required', Rule::in(['published', 'hidden'])],
|
||||
'button' => ['required', 'string', 'max:255'],
|
||||
'send_message' => ['required', 'string', 'max:1000'],
|
||||
'columns' => ['nullable', 'array'],
|
||||
'settings' => ['nullable', 'array'],
|
||||
'settings.personal_data' => ['nullable', 'boolean'],
|
||||
'settings.captcha' => ['nullable', 'boolean'],
|
||||
'settings.period' => ['nullable', 'array'],
|
||||
'mail_settings' => ['nullable', 'array'],
|
||||
];
|
||||
}
|
||||
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'title.required' => 'Название формы обязательно',
|
||||
'title.max' => 'Название не должно превышать 255 символов',
|
||||
'form_id.required' => 'Уникальный ID формы обязателен',
|
||||
'form_id.unique' => 'Такой ID формы уже существует',
|
||||
'description.required' => 'Описание обязательно',
|
||||
'status.required' => 'Статус обязателен',
|
||||
'status.in' => 'Статус должен быть published или hidden',
|
||||
'button.required' => 'Текст кнопки обязателен',
|
||||
'send_message.required' => 'Сообщение после отправки обязательно',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace App\Containers\Dashboard\UI\WEB\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class StoreDepartmentRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'title' => ['required', 'string', 'max:255'],
|
||||
'slug' => ['required', 'string', 'max:255', Rule::unique('departments')],
|
||||
'faculty_id' => ['required', 'exists:faculties,id'],
|
||||
'is_active' => ['boolean'],
|
||||
'content' => ['nullable', 'array'],
|
||||
];
|
||||
}
|
||||
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'title.required' => 'Название кафедры обязательно для заполнения',
|
||||
'title.max' => 'Название не должно превышать 255 символов',
|
||||
'slug.required' => 'URL-адрес обязателен для заполнения',
|
||||
'slug.unique' => 'Такой URL уже используется',
|
||||
'faculty_id.required' => 'Необходимо выбрать факультет',
|
||||
'faculty_id.exists' => 'Выбранный факультет не существует',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Containers\Dashboard\UI\WEB\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class StoreDirectionRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'title' => ['required', 'string', 'max:255'],
|
||||
'slug' => ['required', 'string', 'max:255', 'unique:direction_additional_educations,slug'],
|
||||
'is_active' => ['boolean'],
|
||||
];
|
||||
}
|
||||
|
||||
public function attributes(): array
|
||||
{
|
||||
return [
|
||||
'title' => 'название направления',
|
||||
'slug' => 'URL-идентификатор',
|
||||
'is_active' => 'статус активности',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace App\Containers\Dashboard\UI\WEB\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class StoreDirectionStudyRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'name' => ['required', 'string', 'max:255'],
|
||||
'uuid' => ['required', 'string', 'max:255', 'unique:direction_studies,uuid'],
|
||||
'slug' => ['required', 'string', 'max:255', 'unique:direction_studies,slug'],
|
||||
'code' => ['required', 'string', 'max:50'],
|
||||
'lvl_edu' => ['required', 'integer'],
|
||||
'info' => ['nullable', 'array'],
|
||||
];
|
||||
}
|
||||
|
||||
public function attributes(): array
|
||||
{
|
||||
return [
|
||||
'name' => 'название направления',
|
||||
'uuid' => 'UUID',
|
||||
'slug' => 'URL-идентификатор',
|
||||
'code' => 'код направления',
|
||||
'lvl_edu' => 'уровень образования',
|
||||
'info' => 'информация о направлении',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Containers\Dashboard\UI\WEB\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class StoreDivisionRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'title' => ['required', 'string', 'max:255'],
|
||||
'slug' => ['required', 'string', 'max:255', Rule::unique('divisions')->ignore($this->division)],
|
||||
'is_active' => ['boolean'],
|
||||
'description' => ['nullable', 'array'],
|
||||
];
|
||||
}
|
||||
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'title.required' => 'Название подразделения обязательно для заполнения',
|
||||
'title.max' => 'Название не должно превышать 255 символов',
|
||||
'slug.required' => 'URL-адрес обязателен для заполнения',
|
||||
'slug.unique' => 'Такой URL уже используется',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Containers\Dashboard\UI\WEB\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class StoreEducationalGroupRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'title' => ['required', 'string', 'max:50', 'unique:educational_groups,title'],
|
||||
'faculty_id' => ['required', 'exists:faculties,id'],
|
||||
'education_form_id' => ['required', 'in:1,2,3'],
|
||||
];
|
||||
}
|
||||
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'title.required' => 'Название группы обязательно для заполнения',
|
||||
'title.unique' => 'Группа с таким названием уже существует',
|
||||
'faculty_id.required' => 'Необходимо выбрать факультет',
|
||||
'education_form_id.required' => 'Необходимо выбрать форму обучения',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace App\Containers\Dashboard\UI\WEB\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class StoreEducationalProgramRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'name' => ['required', 'string', 'max:255'],
|
||||
'lvl_edu' => ['required', 'integer'],
|
||||
'status' => ['required', 'integer', 'in:1,2,3,4,5,6'],
|
||||
'lang_stud' => ['required', 'string', 'max:255'],
|
||||
'direction_study_id' => ['nullable', 'exists:direction_studies,id'],
|
||||
'about_program' => ['nullable', 'array'],
|
||||
'program_features' => ['nullable', 'array'],
|
||||
];
|
||||
}
|
||||
|
||||
public function attributes(): array
|
||||
{
|
||||
return [
|
||||
'name' => 'название программы',
|
||||
'lvl_edu' => 'уровень образования',
|
||||
'status' => 'статус программы',
|
||||
'lang_stud' => 'язык обучения',
|
||||
'direction_study_id' => 'направление подготовки',
|
||||
'about_program' => 'описание программы',
|
||||
'program_features' => 'особенности программы',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace App\Containers\Dashboard\UI\WEB\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class StoreFacultyRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'title' => ['required', 'string', 'max:255'],
|
||||
'slug' => ['required', 'string', 'max:255', Rule::unique('faculties')->ignore($this->faculty)],
|
||||
'abbreviation' => ['required', 'string', 'max:10'],
|
||||
'is_active' => ['boolean'],
|
||||
'content' => ['nullable', 'array'],
|
||||
];
|
||||
}
|
||||
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'title.required' => 'Название факультета обязательно для заполнения',
|
||||
'title.max' => 'Название не должно превышать 255 символов',
|
||||
'slug.required' => 'URL-адрес обязателен для заполнения',
|
||||
'slug.unique' => 'Такой URL уже используется',
|
||||
'abbreviation.required' => 'Аббревиатура обязательна',
|
||||
'abbreviation.max' => 'Аббревиатура не должна превышать 10 символов',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace App\Containers\Dashboard\UI\WEB\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class StoreJournalIssueRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'academic_journal_id' => ['required', 'exists:academic_journals,id'],
|
||||
'title' => ['required', 'string', 'max:255'],
|
||||
'path_file' => ['required', 'string'],
|
||||
'year_publication' => [
|
||||
'required',
|
||||
'integer',
|
||||
'min:1900',
|
||||
'max:' . (now()->year + 1),
|
||||
],
|
||||
'is_active' => ['nullable', 'boolean'],
|
||||
'sort' => ['nullable', 'integer'],
|
||||
];
|
||||
}
|
||||
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'title.required' => 'Название выпуска обязательно для заполнения',
|
||||
'title.max' => 'Название выпуска не должно превышать 255 символов',
|
||||
'path_file.required' => 'Файл выпуска обязателен',
|
||||
'year_publication.required' => 'Год публикации обязателен',
|
||||
'year_publication.min' => 'Год должен быть не ранее 1900',
|
||||
'year_publication.max' => 'Год не может быть больше ' . (now()->year + 1),
|
||||
];
|
||||
}
|
||||
|
||||
protected function prepareForValidation(): void
|
||||
{
|
||||
// Значение по умолчанию для is_active
|
||||
if (!isset($this->is_active)) {
|
||||
$this->merge([
|
||||
'is_active' => true,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Containers\Dashboard\UI\WEB\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class StoreMainSectionRequest extends FormRequest
|
||||
{
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'title' => ['required', 'string', 'max:255'],
|
||||
'slug' => ['required', 'string', 'unique:main_sections,slug', 'max:255'],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Containers\Dashboard\UI\WEB\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class StoreNewsCategoryRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'title' => ['required', 'string', 'max:255'],
|
||||
'is_active' => ['boolean'],
|
||||
];
|
||||
}
|
||||
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'title.required' => 'Название категории обязательно для заполнения',
|
||||
'title.max' => 'Название не должно превышать 255 символов',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Containers\Dashboard\UI\WEB\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class StorePageReferenceListRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'title' => ['required', 'string', 'max:255'],
|
||||
'slug' => ['required', 'string', 'max:255', Rule::unique('page_reference_lists', 'slug')],
|
||||
'is_active' => ['boolean'],
|
||||
'content' => ['required', 'array', 'min:1'],
|
||||
'content.*.title' => ['required', 'string', 'max:255'],
|
||||
'content.*.link' => ['required', 'string', 'max:255'],
|
||||
'content.*.link_text' => ['required', 'string', 'max:50'],
|
||||
'content.*.image' => ['nullable', 'string'],
|
||||
'content.*.icon' => ['nullable', 'string'],
|
||||
];
|
||||
}
|
||||
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'title.required' => 'Название обязательно',
|
||||
'slug.required' => 'Slug обязателен',
|
||||
'slug.unique' => 'Такой slug уже существует',
|
||||
'content.required' => 'Добавьте хотя бы один элемент',
|
||||
'content.min' => 'Добавьте хотя бы один элемент',
|
||||
'content.*.title.required' => 'Заголовок элемента обязателен',
|
||||
'content.*.link.required' => 'Ссылка обязательна',
|
||||
'content.*.link_text.required' => 'Текст кнопки обязателен',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace App\Containers\Dashboard\UI\WEB\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class StorePageRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'title' => ['required', 'string', 'max:255'],
|
||||
'slug' => ['required', 'string', 'max:255', Rule::unique('pages', 'slug')],
|
||||
'sub_section_id' => ['nullable', 'exists:sub_sections,id'],
|
||||
'code' => ['required', Rule::in(['200', '404', '500'])],
|
||||
'searchable' => ['boolean'],
|
||||
'icon' => ['nullable', 'string'],
|
||||
'content' => ['nullable', 'array'],
|
||||
'settings' => ['nullable', 'array'],
|
||||
'settings.hide_page_sub_section_links' => ['nullable', 'boolean'],
|
||||
'settings.hide_page_navigate_links' => ['nullable', 'boolean'],
|
||||
'settings.hide_breadcrumbs' => ['nullable', 'boolean'],
|
||||
'settings.form.id' => ['nullable', 'string'],
|
||||
'settings.form.title' => ['nullable', 'string'],
|
||||
'settings.form.description' => ['nullable', 'string'],
|
||||
'settings.form.button' => ['nullable', 'string'],
|
||||
];
|
||||
}
|
||||
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'title.required' => 'Заголовок обязателен для заполнения',
|
||||
'title.max' => 'Заголовок не должен превышать 255 символов',
|
||||
'slug.required' => 'URL-адрес обязателен',
|
||||
'slug.unique' => 'Такой URL-адрес уже используется',
|
||||
'slug.max' => 'URL-адрес не должен превышать 255 символов',
|
||||
'sub_section_id.exists' => 'Выбранный подраздел не существует',
|
||||
'code.required' => 'Код страницы обязателен',
|
||||
'code.in' => 'Код страницы должен быть 200, 404 или 500',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
namespace App\Containers\Dashboard\UI\WEB\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class StorePostRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'title' => ['required', 'string', 'max:255'],
|
||||
'slug' => ['required', 'string', 'max:255', Rule::unique('posts', 'slug')->ignore($this->route('post'))],
|
||||
'status' => ['required', 'integer', Rule::in([0, 1, 2, 3])], // PostStatus enum values
|
||||
'category_id' => ['nullable', 'integer', 'exists:categories,id'],
|
||||
'tags' => ['nullable', 'array'],
|
||||
'authors' => ['nullable', 'array'],
|
||||
'content' => ['required', 'array'],
|
||||
'preview' => ['nullable', 'string'],
|
||||
'images' => ['nullable', 'array'],
|
||||
'publish_setting' => ['nullable', 'array'],
|
||||
'publish_setting.publish_after' => ['nullable', 'boolean'],
|
||||
'publish_setting.publish_at' => ['nullable', 'date', 'after:now'],
|
||||
'publication' => ['nullable', 'array'],
|
||||
'publication.vk' => ['nullable', 'boolean'],
|
||||
'publication.telegram' => ['nullable', 'boolean'],
|
||||
'is_slider_enabled' => ['nullable', 'boolean'],
|
||||
'slide' => ['nullable', 'array'],
|
||||
'slide.slider_id' => ['nullable', 'integer', 'exists:sliders,id'],
|
||||
'slide.title' => ['nullable', 'string', 'max:100'],
|
||||
'slide.content' => ['nullable', 'string', 'max:255'],
|
||||
'slide.color_theme' => ['nullable', 'string'],
|
||||
'slide.image' => ['nullable', 'array'],
|
||||
'slide.image.url' => ['nullable', 'string'],
|
||||
'slide.image.shading' => ['nullable', 'string'],
|
||||
'slide.settings' => ['nullable', 'array'],
|
||||
'slide.settings.text_position' => ['nullable', 'string', 'in:left,center,right'],
|
||||
'slide.settings.link_text' => ['nullable', 'string', 'max:20'],
|
||||
'slide.end_time' => ['nullable', 'date'],
|
||||
];
|
||||
}
|
||||
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'title.required' => 'Заголовок обязателен для заполнения',
|
||||
'title.max' => 'Заголовок не должен превышать 255 символов',
|
||||
'slug.required' => 'URL-адрес обязателен',
|
||||
'slug.unique' => 'Такой URL-адрес уже используется',
|
||||
'status.required' => 'Статус публикации обязателен',
|
||||
'status.in' => 'Некорректный статус публикации',
|
||||
'category_id.exists' => 'Выбранная категория не существует',
|
||||
'content.required' => 'Содержание новости обязательно',
|
||||
'publish_setting.publish_at.after' => 'Дата публикации должна быть в будущем',
|
||||
'slide.slider_id.exists' => 'Выбранный слайдер не существует',
|
||||
'slide.title.max' => 'Заголовок слайда не должен превышать 100 символов',
|
||||
'slide.content.max' => 'Текст слайда не должен превышать 255 символов',
|
||||
'slide.settings.text_position.in' => 'Некорректная позиция текста',
|
||||
'slide.settings.link_text.max' => 'Текст кнопки не должен превышать 20 символов',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Containers\Dashboard\UI\WEB\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class StoreScheduleRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'educational_group_id' => ['required', 'exists:educational_groups,id'],
|
||||
'file' => ['required', 'array', 'min:1', 'max:1'],
|
||||
'file.0.title' => ['required', 'string', 'max:255'],
|
||||
'file.0.path' => ['required', 'file', 'mimes:pdf', 'max:10000'],
|
||||
];
|
||||
}
|
||||
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'educational_group_id.required' => 'Необходимо выбрать учебную группу',
|
||||
'educational_group_id.exists' => 'Выбранная учебная группа не существует',
|
||||
'file.required' => 'Необходимо загрузить файл расписания',
|
||||
'file.0.title.required' => 'Необходимо указать название файла',
|
||||
'file.0.path.required' => 'Необходимо загрузить PDF файл',
|
||||
'file.0.path.mimes' => 'Файл должен быть в формате PDF',
|
||||
'file.0.path.max' => 'Размер файла не должен превышать 10MB',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Containers\Dashboard\UI\WEB\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class StoreSlideRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'title' => 'nullable|string|max:255',
|
||||
'content' => 'nullable|string|max:1000',
|
||||
'image' => 'required',
|
||||
'link' => 'required|string|max:255',
|
||||
'settings' => 'nullable|array',
|
||||
'settings.text_position' => 'nullable|string|in:left,center,right',
|
||||
'settings.link_text' => 'nullable|string|max:50',
|
||||
'settings.shading' => 'nullable|string',
|
||||
'settings.active_button' => 'nullable|in:0,1,true,false',
|
||||
'color_theme' => 'required|string',
|
||||
'is_active' => 'nullable|in:0,1,true,false',
|
||||
'start_time' => 'nullable|date',
|
||||
'end_time' => 'nullable|date|after_or_equal:start_time',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Containers\Dashboard\UI\WEB\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class StoreSliderRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'title' => 'required|string|max:255',
|
||||
'slug' => 'nullable|string|max:255|unique:sliders,slug',
|
||||
'is_active' => 'boolean',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Containers\Dashboard\UI\WEB\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class StoreSubSectionRequest extends FormRequest
|
||||
{
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'title' => ['required', 'string', 'max:255'],
|
||||
'slug' => ['required', 'string', 'unique:sub_sections,slug', 'max:255'],
|
||||
'main_section_id' => ['nullable', 'exists:main_sections,id'],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Containers\Dashboard\UI\WEB\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class StoreUserDetailRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'is_only_worker' => ['nullable', 'boolean'],
|
||||
'photo' => ['nullable', 'file', 'image', 'max:10240'], // 10MB max
|
||||
'contactEmail' => ['nullable', 'email', 'max:255'],
|
||||
'contactPhone' => ['nullable', 'string', 'max:255'],
|
||||
'academicTitle' => ['nullable', 'string', 'max:255'],
|
||||
'AcademicDegree' => ['nullable', 'string', 'max:255'],
|
||||
'workExperience' => ['nullable'],
|
||||
'education' => ['nullable'],
|
||||
'professionalRetraining' => ['nullable'],
|
||||
'professionalDevelopment' => ['nullable'],
|
||||
'awards' => ['nullable'],
|
||||
'professDisciplines' => ['nullable'],
|
||||
'attendedConferences' => ['nullable'],
|
||||
'publications' => ['nullable'],
|
||||
'participationScienceProjects' => ['nullable'],
|
||||
'other' => ['nullable'],
|
||||
];
|
||||
}
|
||||
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'contactEmail.email' => 'Некорректный формат email',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace App\Containers\Dashboard\UI\WEB\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class StoreUserRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'name' => ['required', 'string', 'max:255'],
|
||||
'email' => ['required', 'email', 'max:255', 'unique:users,email'],
|
||||
'password' => ['required', 'string', 'min:8', 'max:255'],
|
||||
'roles' => ['nullable', 'array'],
|
||||
'roles.*' => ['string', 'exists:roles,name'],
|
||||
'permissions' => ['nullable', 'array'],
|
||||
'permissions.*' => ['string', 'exists:permissions,name'],
|
||||
];
|
||||
}
|
||||
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'name.required' => 'ФИО обязательно для заполнения',
|
||||
'email.required' => 'Email обязателен для заполнения',
|
||||
'email.email' => 'Некорректный формат email',
|
||||
'email.unique' => 'Пользователь с таким email уже существует',
|
||||
'password.required' => 'Пароль обязателен для заполнения',
|
||||
'password.min' => 'Пароль должен содержать минимум 8 символов',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
<?php
|
||||
|
||||
namespace App\Containers\Dashboard\UI\WEB\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class UpdateAcademicJournalRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'title' => ['required', 'string', 'max:255'],
|
||||
'slug' => [
|
||||
'required',
|
||||
'string',
|
||||
'max:255',
|
||||
'unique:academic_journals,slug,' . $this->route('academicJournal')->id,
|
||||
],
|
||||
'main_info' => ['nullable', 'array'],
|
||||
'chief_editor' => ['nullable', 'array'],
|
||||
'editors' => ['nullable', 'array'],
|
||||
'for_authors' => ['nullable', 'array'],
|
||||
];
|
||||
}
|
||||
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'title.required' => 'Название журнала обязательно для заполнения',
|
||||
'title.max' => 'Название журнала не должно превышать 255 символов',
|
||||
'slug.required' => 'URL-адрес обязателен для заполнения',
|
||||
'slug.unique' => 'Журнал с таким URL-адресом уже существует',
|
||||
];
|
||||
}
|
||||
|
||||
protected function prepareForValidation(): void
|
||||
{
|
||||
// Автоматическая генерация slug если не передан
|
||||
if (empty($this->slug) && !empty($this->title)) {
|
||||
$this->merge([
|
||||
'slug' => Str::slug($this->title),
|
||||
]);
|
||||
}
|
||||
|
||||
// Генерация search_data из main_info
|
||||
if (!empty($this->main_info)) {
|
||||
$this->merge([
|
||||
'search_data' => $this->generateSearchData($this->main_info),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
private function generateSearchData(array $data): string
|
||||
{
|
||||
$parts = [];
|
||||
foreach ($data as $block) {
|
||||
$parts[] = $this->getDataFromBlocks($block);
|
||||
}
|
||||
$result = implode(' ', $parts);
|
||||
$result = preg_replace('/\s+/', ' ', $result);
|
||||
$result = trim($result);
|
||||
|
||||
return strtolower($result);
|
||||
}
|
||||
|
||||
private function getDataFromBlocks($block): string
|
||||
{
|
||||
$data = '';
|
||||
switch ($block['type']) {
|
||||
case 'paragraph':
|
||||
$data .= strip_tags($block['data']['content']) . ' ';
|
||||
break;
|
||||
case 'heading':
|
||||
$data .= strip_tags($block['data']['content']) . ' ';
|
||||
break;
|
||||
case 'files':
|
||||
foreach ($block['data']['file'] as $file) {
|
||||
$data .= $file['title'] . ' ';
|
||||
}
|
||||
break;
|
||||
case 'person':
|
||||
$data .= $block['data']['name'] . ' ';
|
||||
break;
|
||||
case 'stepper':
|
||||
$data .= $block['data']['step_name'] . ' ';
|
||||
foreach ($block['data']['steps'] as $step) {
|
||||
$data .= $step['title'] . ' ';
|
||||
$data .= strip_tags($step['content']) . ' ';
|
||||
}
|
||||
break;
|
||||
case 'tabs':
|
||||
foreach ($block['data']['tab'] as $item) {
|
||||
foreach ($item['content'] as $blockItem) {
|
||||
$data .= $this->getDataFromBlocks($blockItem);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Containers\Dashboard\UI\WEB\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class UpdateAdditionalEducationRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
$educationId = $this->route('additionalEducation')?->id;
|
||||
|
||||
return [
|
||||
'title' => ['required', 'string', 'max:255'],
|
||||
'slug' => ['required', 'string', 'max:255', Rule::unique('additional_educations', 'slug')->ignore($educationId)],
|
||||
'category_id' => ['required', 'exists:additional_education_categories,id'],
|
||||
'target_group' => ['required', 'string', 'max:255'],
|
||||
'qualification' => ['nullable', 'string', 'max:255'],
|
||||
'price' => ['required', 'numeric', 'min:0'],
|
||||
'learning_time' => ['required', 'integer', 'min:1'],
|
||||
'form_education' => ['required', 'integer', 'in:1,2,3'],
|
||||
'is_active' => ['boolean'],
|
||||
'content' => ['nullable', 'array'],
|
||||
];
|
||||
}
|
||||
|
||||
public function attributes(): array
|
||||
{
|
||||
return [
|
||||
'title' => 'название программы',
|
||||
'slug' => 'URL-адрес',
|
||||
'category_id' => 'категория',
|
||||
'target_group' => 'целевая аудитория',
|
||||
'qualification' => 'выдаваемый документ',
|
||||
'price' => 'стоимость',
|
||||
'learning_time' => 'объем (часов)',
|
||||
'form_education' => 'форма обучения',
|
||||
'is_active' => 'статус активности',
|
||||
'content' => 'содержание программы',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace App\Containers\Dashboard\UI\WEB\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class UpdateAdmissionCampaignRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'name' => ['required', 'string', 'max:255'],
|
||||
'academic_year' => ['required', 'string', 'max:20'],
|
||||
'status' => ['required', 'integer', 'in:1,2,3'],
|
||||
'info' => ['nullable', 'array'],
|
||||
'info.*.edu_name' => ['required_with:info', 'integer'],
|
||||
'info.*.total_programs' => ['required_with:info', 'integer', 'min:0'],
|
||||
'info.*.och_count' => ['required_with:info', 'integer', 'min:0'],
|
||||
'info.*.zaoch_count' => ['required_with:info', 'integer', 'min:0'],
|
||||
'info.*.budget_places' => ['required_with:info', 'integer', 'min:0'],
|
||||
'info.*.non_budget_places' => ['required_with:info', 'integer', 'min:0'],
|
||||
];
|
||||
}
|
||||
|
||||
public function attributes(): array
|
||||
{
|
||||
return [
|
||||
'name' => 'название кампании',
|
||||
'academic_year' => 'академический год',
|
||||
'status' => 'статус кампании',
|
||||
'info' => 'информация о наборе',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace App\Containers\Dashboard\UI\WEB\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class UpdateAdmissionPlanRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'educational_programs_id' => ['required', 'exists:educational_programs,id'],
|
||||
'admission_campaigns_id' => ['required', 'exists:admission_campaigns,id'],
|
||||
'exams' => ['nullable', 'array'],
|
||||
'exams.*.title' => ['required_with:exams', 'string', 'max:100'],
|
||||
'exams.*.priority' => ['required_with:exams', 'integer', 'min:0'],
|
||||
'exams.*.types' => ['nullable', 'array'],
|
||||
'exams.*.types.*.type' => ['required_with:exams.*.types', 'integer'],
|
||||
'exams.*.types.*.min_ball' => ['required_with:exams.*.types', 'integer', 'min:0', 'max:100'],
|
||||
'contests' => ['nullable', 'array'],
|
||||
'contests.*.form_education' => ['required_with:contests', 'integer'],
|
||||
'contests.*.places.form_budget' => ['required_with:contests', 'integer'],
|
||||
'contests.*.places.count' => ['required_with:contests', 'integer', 'min:0'],
|
||||
];
|
||||
}
|
||||
|
||||
public function attributes(): array
|
||||
{
|
||||
return [
|
||||
'educational_programs_id' => 'образовательная программа',
|
||||
'admission_campaigns_id' => 'приемная кампания',
|
||||
'exams' => 'вступительные испытания',
|
||||
'contests' => 'условия поступления',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Containers\Dashboard\UI\WEB\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class UpdateCategoryRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
$categoryId = $this->route('category')?->id;
|
||||
|
||||
return [
|
||||
'title' => ['required', 'string', 'max:255'],
|
||||
'slug' => ['required', 'string', 'max:255', Rule::unique('additional_education_categories', 'slug')->ignore($categoryId)],
|
||||
'dir_addit_educat_id' => ['required', 'exists:direction_additional_educations,id'],
|
||||
'is_active' => ['boolean'],
|
||||
];
|
||||
}
|
||||
|
||||
public function attributes(): array
|
||||
{
|
||||
return [
|
||||
'title' => 'название категории',
|
||||
'slug' => 'URL-идентификатор',
|
||||
'dir_addit_educat_id' => 'направление ДПО',
|
||||
'is_active' => 'статус активности',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace App\Containers\Dashboard\UI\WEB\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class UpdateContactWidgetRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
$widgetId = $this->route('contactWidget')?->id;
|
||||
|
||||
return [
|
||||
'title' => ['required', 'string', 'max:255'],
|
||||
'slug' => ['required', 'string', 'max:255', Rule::unique('contact_widgets', 'slug')->ignore($widgetId)],
|
||||
'is_active' => ['boolean'],
|
||||
'content' => ['required', 'array', 'min:1'],
|
||||
'content.*.title' => ['required', 'string', 'max:255'],
|
||||
'content.*.items' => ['required', 'array', 'min:1'],
|
||||
'content.*.items.*.header' => ['required', 'string', 'max:255'],
|
||||
'content.*.items.*.details' => ['nullable', 'array'],
|
||||
'content.*.items.*.details.*.content' => ['required', 'string'],
|
||||
'content.*.items.*.details.*.url' => ['nullable', 'url'],
|
||||
];
|
||||
}
|
||||
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'title.required' => 'Название ресурса обязательно для заполнения',
|
||||
'title.max' => 'Название не должно превышать 255 символов',
|
||||
'slug.required' => 'URL-адрес обязателен',
|
||||
'slug.unique' => 'Такой URL-адрес уже используется',
|
||||
'slug.max' => 'URL-адрес не должен превышать 255 символов',
|
||||
'content.required' => 'Содержание обязательно для заполнения',
|
||||
'content.*.title.required' => 'Заголовок столбца обязателен',
|
||||
'content.*.items.required' => 'Добавьте хотя бы один контактный блок',
|
||||
'content.*.items.*.header.required' => 'Заголовок контакта обязателен',
|
||||
'content.*.items.*.details.*.content.required' => 'Значение контакта обязательно',
|
||||
'content.*.items.*.details.*.url.url' => 'Укажите корректный URL',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace App\Containers\Dashboard\UI\WEB\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class UpdateCustomFormRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
$formId = $this->route('customForm')?->id;
|
||||
|
||||
return [
|
||||
'title' => ['required', 'string', 'max:255'],
|
||||
'form_id' => ['required', 'string', 'max:255', Rule::unique('custom_forms', 'form_id')->ignore($formId)],
|
||||
'description' => ['required', 'string', 'max:2000'],
|
||||
'status' => ['required', Rule::in(['published', 'hidden'])],
|
||||
'button' => ['required', 'string', 'max:255'],
|
||||
'send_message' => ['required', 'string', 'max:1000'],
|
||||
'columns' => ['nullable', 'array'],
|
||||
'settings' => ['nullable', 'array'],
|
||||
'settings.personal_data' => ['nullable', 'boolean'],
|
||||
'settings.captcha' => ['nullable', 'boolean'],
|
||||
'settings.period' => ['nullable', 'array'],
|
||||
'mail_settings' => ['nullable', 'array'],
|
||||
];
|
||||
}
|
||||
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'title.required' => 'Название формы обязательно',
|
||||
'title.max' => 'Название не должно превышать 255 символов',
|
||||
'form_id.required' => 'Уникальный ID формы обязателен',
|
||||
'form_id.unique' => 'Такой ID формы уже существует',
|
||||
'description.required' => 'Описание обязательно',
|
||||
'status.required' => 'Статус обязателен',
|
||||
'status.in' => 'Статус должен быть published или hidden',
|
||||
'button.required' => 'Текст кнопки обязателен',
|
||||
'send_message.required' => 'Сообщение после отправки обязательно',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace App\Containers\Dashboard\UI\WEB\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class UpdateDepartmentRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'title' => ['required', 'string', 'max:255'],
|
||||
'slug' => ['required', 'string', 'max:255', Rule::unique('departments')->ignore($this->department)],
|
||||
'faculty_id' => ['required', 'exists:faculties,id'],
|
||||
'is_active' => ['boolean'],
|
||||
'content' => ['nullable', 'array'],
|
||||
];
|
||||
}
|
||||
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'title.required' => 'Название кафедры обязательно для заполнения',
|
||||
'title.max' => 'Название не должно превышать 255 символов',
|
||||
'slug.required' => 'URL-адрес обязателен для заполнения',
|
||||
'slug.unique' => 'Такой URL уже используется',
|
||||
'faculty_id.required' => 'Необходимо выбрать факультет',
|
||||
'faculty_id.exists' => 'Выбранный факультет не существует',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Containers\Dashboard\UI\WEB\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class UpdateDirectionRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
$directionId = $this->route('direction')?->id;
|
||||
|
||||
return [
|
||||
'title' => ['required', 'string', 'max:255'],
|
||||
'slug' => ['required', 'string', 'max:255', Rule::unique('direction_additional_educations', 'slug')->ignore($directionId)],
|
||||
'is_active' => ['boolean'],
|
||||
];
|
||||
}
|
||||
|
||||
public function attributes(): array
|
||||
{
|
||||
return [
|
||||
'title' => 'название направления',
|
||||
'slug' => 'URL-идентификатор',
|
||||
'is_active' => 'статус активности',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Containers\Dashboard\UI\WEB\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class UpdateDirectionStudyRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
$directionId = $this->route('directionStudy')?->id;
|
||||
|
||||
return [
|
||||
'name' => ['required', 'string', 'max:255'],
|
||||
'uuid' => ['required', 'string', 'max:255', Rule::unique('direction_studies', 'uuid')->ignore($directionId)],
|
||||
'slug' => ['required', 'string', 'max:255', Rule::unique('direction_studies', 'slug')->ignore($directionId)],
|
||||
'code' => ['required', 'string', 'max:50'],
|
||||
'lvl_edu' => ['required', 'integer'],
|
||||
'info' => ['nullable', 'array'],
|
||||
];
|
||||
}
|
||||
|
||||
public function attributes(): array
|
||||
{
|
||||
return [
|
||||
'name' => 'название направления',
|
||||
'uuid' => 'UUID',
|
||||
'slug' => 'URL-идентификатор',
|
||||
'code' => 'код направления',
|
||||
'lvl_edu' => 'уровень образования',
|
||||
'info' => 'информация о направлении',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Containers\Dashboard\UI\WEB\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class UpdateDivisionRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'title' => ['required', 'string', 'max:255'],
|
||||
'slug' => ['required', 'string', 'max:255', Rule::unique('divisions')->ignore($this->division)],
|
||||
'is_active' => ['boolean'],
|
||||
'description' => ['nullable', 'array'],
|
||||
];
|
||||
}
|
||||
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'title.required' => 'Название подразделения обязательно для заполнения',
|
||||
'title.max' => 'Название не должно превышать 255 символов',
|
||||
'slug.required' => 'URL-адрес обязателен для заполнения',
|
||||
'slug.unique' => 'Такой URL уже используется',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Containers\Dashboard\UI\WEB\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class UpdateEducationalGroupRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
$groupId = $this->route('educationalGroup')->id;
|
||||
|
||||
return [
|
||||
'title' => ['required', 'string', 'max:50', 'unique:educational_groups,title,' . $groupId],
|
||||
'faculty_id' => ['required', 'exists:faculties,id'],
|
||||
'education_form_id' => ['required', 'in:1,2,3'],
|
||||
];
|
||||
}
|
||||
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'title.required' => 'Название группы обязательно для заполнения',
|
||||
'title.unique' => 'Группа с таким названием уже существует',
|
||||
'faculty_id.required' => 'Необходимо выбрать факультет',
|
||||
'education_form_id.required' => 'Необходимо выбрать форму обучения',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Containers\Dashboard\UI\WEB\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class UpdateEducationalProgramRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
$programId = $this->route('educationalProgram')?->id;
|
||||
|
||||
return [
|
||||
'name' => ['required', 'string', 'max:255'],
|
||||
'lvl_edu' => ['required', 'integer'],
|
||||
'status' => ['required', 'integer', 'in:1,2,3,4,5,6'],
|
||||
'lang_stud' => ['required', 'string', 'max:255'],
|
||||
'direction_study_id' => ['nullable', 'exists:direction_studies,id'],
|
||||
'about_program' => ['nullable', 'array'],
|
||||
'program_features' => ['nullable', 'array'],
|
||||
];
|
||||
}
|
||||
|
||||
public function attributes(): array
|
||||
{
|
||||
return [
|
||||
'name' => 'название программы',
|
||||
'lvl_edu' => 'уровень образования',
|
||||
'status' => 'статус программы',
|
||||
'lang_stud' => 'язык обучения',
|
||||
'direction_study_id' => 'направление подготовки',
|
||||
'about_program' => 'описание программы',
|
||||
'program_features' => 'особенности программы',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace App\Containers\Dashboard\UI\WEB\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class UpdateFacultyRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'title' => ['required', 'string', 'max:255'],
|
||||
'slug' => ['required', 'string', 'max:255', Rule::unique('faculties')->ignore($this->faculty)],
|
||||
'abbreviation' => ['required', 'string', 'max:10'],
|
||||
'is_active' => ['boolean'],
|
||||
'content' => ['nullable', 'array'],
|
||||
];
|
||||
}
|
||||
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'title.required' => 'Название факультета обязательно для заполнения',
|
||||
'title.max' => 'Название не должно превышать 255 символов',
|
||||
'slug.required' => 'URL-адрес обязателен для заполнения',
|
||||
'slug.unique' => 'Такой URL уже используется',
|
||||
'abbreviation.required' => 'Аббревиатура обязательна',
|
||||
'abbreviation.max' => 'Аббревиатура не должна превышать 10 символов',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace App\Containers\Dashboard\UI\WEB\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class UpdateJournalIssueRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'title' => ['required', 'string', 'max:255'],
|
||||
'path_file' => ['required', 'string'],
|
||||
'year_publication' => [
|
||||
'required',
|
||||
'integer',
|
||||
'min:1900',
|
||||
'max:' . (now()->year + 1),
|
||||
],
|
||||
'is_active' => ['nullable', 'boolean'],
|
||||
'sort' => ['nullable', 'integer'],
|
||||
];
|
||||
}
|
||||
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'title.required' => 'Название выпуска обязательно для заполнения',
|
||||
'title.max' => 'Название выпуска не должно превышать 255 символов',
|
||||
'path_file.required' => 'Файл выпуска обязателен',
|
||||
'year_publication.required' => 'Год публикации обязателен',
|
||||
'year_publication.min' => 'Год должен быть не ранее 1900',
|
||||
'year_publication.max' => 'Год не может быть больше ' . (now()->year + 1),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Containers\Dashboard\UI\WEB\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class UpdateMainSectionRequest extends FormRequest
|
||||
{
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'title' => ['required', 'string', 'max:255'],
|
||||
'slug' => ['required', 'string', 'unique:main_sections,slug,' . $this->mainSection->id, 'max:255'],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Containers\Dashboard\UI\WEB\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class UpdateNewsCategoryRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
$categoryId = $this->route('category')?->id;
|
||||
|
||||
return [
|
||||
'title' => ['required', 'string', 'max:255'],
|
||||
'is_active' => ['boolean'],
|
||||
];
|
||||
}
|
||||
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'title.required' => 'Название категории обязательно для заполнения',
|
||||
'title.max' => 'Название не должно превышать 255 символов',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace App\Containers\Dashboard\UI\WEB\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class UpdatePageReferenceListRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
$listId = $this->route('pageReferenceList')?->id;
|
||||
|
||||
return [
|
||||
'title' => ['required', 'string', 'max:255'],
|
||||
'slug' => ['required', 'string', 'max:255', Rule::unique('page_reference_lists', 'slug')->ignore($listId)],
|
||||
'is_active' => ['boolean'],
|
||||
'content' => ['required', 'array', 'min:1'],
|
||||
'content.*.title' => ['required', 'string', 'max:255'],
|
||||
'content.*.link' => ['required', 'string', 'max:255'],
|
||||
'content.*.link_text' => ['required', 'string', 'max:50'],
|
||||
'content.*.image' => ['nullable', 'string'],
|
||||
'content.*.icon' => ['nullable', 'string'],
|
||||
];
|
||||
}
|
||||
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'title.required' => 'Название обязательно',
|
||||
'slug.required' => 'Slug обязателен',
|
||||
'slug.unique' => 'Такой slug уже существует',
|
||||
'content.required' => 'Добавьте хотя бы один элемент',
|
||||
'content.min' => 'Добавьте хотя бы один элемент',
|
||||
'content.*.title.required' => 'Заголовок элемента обязателен',
|
||||
'content.*.link.required' => 'Ссылка обязательна',
|
||||
'content.*.link_text.required' => 'Текст кнопки обязателен',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace App\Containers\Dashboard\UI\WEB\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class UpdatePageRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'title' => ['required', 'string', 'max:255'],
|
||||
'slug' => ['required', 'string', 'max:255', Rule::unique('pages', 'slug')->ignore($this->page->id)],
|
||||
'sub_section_id' => ['nullable', 'exists:sub_sections,id'],
|
||||
'code' => ['required', Rule::in(['200', '404', '500'])],
|
||||
'searchable' => ['boolean'],
|
||||
'icon' => ['nullable', 'string'],
|
||||
'content' => ['nullable', 'array'],
|
||||
'settings' => ['nullable', 'array'],
|
||||
'settings.hide_page_sub_section_links' => ['nullable', 'boolean'],
|
||||
'settings.hide_page_navigate_links' => ['nullable', 'boolean'],
|
||||
'settings.hide_breadcrumbs' => ['nullable', 'boolean'],
|
||||
'settings.form.id' => ['nullable', 'string'],
|
||||
'settings.form.title' => ['nullable', 'string'],
|
||||
'settings.form.description' => ['nullable', 'string'],
|
||||
'settings.form.button' => ['nullable', 'string'],
|
||||
];
|
||||
}
|
||||
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'title.required' => 'Заголовок обязателен для заполнения',
|
||||
'title.max' => 'Заголовок не должен превышать 255 символов',
|
||||
'slug.required' => 'URL-адрес обязателен',
|
||||
'slug.unique' => 'Такой URL-адрес уже используется',
|
||||
'slug.max' => 'URL-адрес не должен превышать 255 символов',
|
||||
'sub_section_id.exists' => 'Выбранный подраздел не существует',
|
||||
'code.required' => 'Код страницы обязателен',
|
||||
'code.in' => 'Код страницы должен быть 200, 404 или 500',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Containers\Dashboard\UI\WEB\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class UpdateScheduleRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'educational_group_id' => ['required', 'exists:educational_groups,id'],
|
||||
'file' => ['sometimes', 'array', 'min:1', 'max:1'],
|
||||
'file.0.title' => ['required_with:file', 'string', 'max:255'],
|
||||
'file.0.path' => ['required_with:file', 'file', 'mimes:pdf', 'max:10000'],
|
||||
];
|
||||
}
|
||||
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'educational_group_id.required' => 'Необходимо выбрать учебную группу',
|
||||
'educational_group_id.exists' => 'Выбранная учебная группа не существует',
|
||||
'file.0.title.required' => 'Необходимо указать название файла',
|
||||
'file.0.path.required' => 'Необходимо загрузить PDF файл',
|
||||
'file.0.path.mimes' => 'Файл должен быть в формате PDF',
|
||||
'file.0.path.max' => 'Размер файла не должен превышать 10MB',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Containers\Dashboard\UI\WEB\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class UpdateSlideRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'title' => 'nullable|string|max:255',
|
||||
'content' => 'nullable|string|max:1000',
|
||||
'image' => 'sometimes',
|
||||
'link' => 'sometimes|required|string|max:255',
|
||||
'settings' => 'nullable|array',
|
||||
'settings.text_position' => 'nullable|string|in:left,center,right',
|
||||
'settings.link_text' => 'nullable|string|max:50',
|
||||
'settings.shading' => 'nullable|string',
|
||||
'settings.active_button' => 'nullable|in:0,1,true,false',
|
||||
'color_theme' => 'sometimes|required|string',
|
||||
'is_active' => 'nullable|in:0,1,true,false',
|
||||
'start_time' => 'nullable|date',
|
||||
'end_time' => 'nullable|date|after_or_equal:start_time',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Containers\Dashboard\UI\WEB\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class UpdateSliderRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'title' => 'sometimes|required|string|max:255',
|
||||
'slug' => 'sometimes|required|string|max:255|unique:sliders,slug,' . $this->slider->id,
|
||||
'is_active' => 'sometimes|boolean',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Containers\Dashboard\UI\WEB\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class UpdateSubSectionRequest extends FormRequest
|
||||
{
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'title' => ['required', 'string', 'max:255'],
|
||||
'slug' => ['required', 'string', 'unique:sub_sections,slug,' . $this->subSection->id, 'max:255'],
|
||||
'main_section_id' => ['nullable', 'exists:main_sections,id'],
|
||||
'page_ids' => ['nullable', 'array'],
|
||||
'page_ids.*' => ['exists:pages,id'],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Containers\Dashboard\UI\WEB\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class UpdateUserDetailRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'is_only_worker' => ['nullable', 'boolean'],
|
||||
'photo' => ['nullable', 'file', 'image', 'max:10240'], // 10MB max
|
||||
'contactEmail' => ['nullable', 'email', 'max:255'],
|
||||
'contactPhone' => ['nullable', 'string', 'max:255'],
|
||||
'academicTitle' => ['nullable', 'string', 'max:255'],
|
||||
'AcademicDegree' => ['nullable', 'string', 'max:255'],
|
||||
'workExperience' => ['nullable'],
|
||||
'education' => ['nullable'],
|
||||
'professionalRetraining' => ['nullable'],
|
||||
'professionalDevelopment' => ['nullable'],
|
||||
'awards' => ['nullable'],
|
||||
'professDisciplines' => ['nullable'],
|
||||
'attendedConferences' => ['nullable'],
|
||||
'publications' => ['nullable'],
|
||||
'participationScienceProjects' => ['nullable'],
|
||||
'other' => ['nullable'],
|
||||
];
|
||||
}
|
||||
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'contactEmail.email' => 'Некорректный формат email',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Containers\Dashboard\UI\WEB\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class UpdateUserRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
$userId = $this->route('user')->id;
|
||||
|
||||
return [
|
||||
'name' => ['required', 'string', 'max:255'],
|
||||
'email' => ['required', 'email', 'max:255', Rule::unique('users', 'email')->ignore($userId)],
|
||||
'password' => ['nullable', 'string', 'min:8', 'max:255'],
|
||||
'roles' => ['nullable', 'array'],
|
||||
'roles.*' => ['string', 'exists:roles,name'],
|
||||
'permissions' => ['nullable', 'array'],
|
||||
'permissions.*' => ['string', 'exists:permissions,name'],
|
||||
];
|
||||
}
|
||||
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'name.required' => 'ФИО обязательно для заполнения',
|
||||
'email.required' => 'Email обязателен для заполнения',
|
||||
'email.email' => 'Некорректный формат email',
|
||||
'email.unique' => 'Пользователь с таким email уже существует',
|
||||
'password.min' => 'Пароль должен содержать минимум 8 символов',
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user