refactoring requests rules

This commit is contained in:
aslan 2024-02-13 15:38:30 +03:00
parent 3e50dee628
commit 968a4b06c8
12 changed files with 14 additions and 75 deletions

View File

@ -1,31 +0,0 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class StoreFileRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
'name' => 'max:255',
'position' => 'int|max:255',
'url' => 'file',
'idReceptionScreen' => 'int|max:255',
];
}
}

View File

@ -1,30 +0,0 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class UpdateFileRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
'name' => 'required|max:255',
'position' => 'required||int|max:255',
'idReceptionScreen' => 'int|max:255',
];
}
}

View File

@ -16,7 +16,7 @@ class StoreDepartmentRequest extends FormRequest
{
return [
'position' => 'required|int|max:255',
'name' => 'required|string|max:255|unique:educational_institutions,name',
'name' => 'required|string|max:255|unique:departments,name',
'description' => 'string',
'slug' => 'required|string',
'faculty_id' => 'required|int',

View File

@ -15,7 +15,7 @@ class StoreDirectionRequest extends FormRequest
{
return [
'position' => 'required|int|max:255',
'name' => 'required|string|max:255|unique:educational_institutions,name',
'name' => 'required|string|max:255|unique:directions,name',
'description' => 'string',
'slug' => 'required|string',
'department_id' => 'required|int'

View File

@ -14,7 +14,7 @@ class StoreEducationalInstitutionRequest extends FormRequest
public function rules(): array
{
return [
'position' => 'int|max:255',
'position' => 'required|int|max:255',
'name' => 'required|string|max:255|unique:educational_institutions,name',
'description' => 'string',
'slug' => 'required|string',

View File

@ -15,11 +15,11 @@ class StoreFacultyRequest extends FormRequest
public function rules(): array
{
return [
'position' => 'int|max:255',
'name' => 'required|string|max:255|unique:educational_institutions,name',
'position' => 'required|int|max:255',
'name' => 'required|string|max:255|unique:faculties,name',
'description' => 'string',
'slug' => 'required|string',
'educational_institution_id' => 'int'
'educational_institution_id' => 'required|int'
];
}
}

View File

@ -21,7 +21,7 @@ class UpdateDepartmentRequest extends FormRequest
'required',
'string',
'max:255',
"unique:educational_institutions,name,{$this->department->id}",
"unique:departments,name,{$this->department->id}",
],
];
}

View File

@ -15,7 +15,7 @@ class UpdateDirectionRequest extends FormRequest
public function rules(): array
{
return [
'position' => 'int|max:255',
'position' => 'required|int|max:255',
'description' => 'string',
'department_id' => 'int|required',
'slug' => 'required|string',
@ -23,7 +23,7 @@ class UpdateDirectionRequest extends FormRequest
'required',
'string',
'max:255',
"unique:educational_institutions,name,{$this->direction->id}",
"unique:directions,name,{$this->direction->id}",
],
];
}

View File

@ -15,7 +15,7 @@ class UpdateEducationalInstitutionRequest extends FormRequest
public function rules(): array
{
return [
'position' => 'int|max:255',
'position' => 'required|int|max:255',
'description' => 'string',
'slug' => 'required|string',
'name' => [

View File

@ -14,10 +14,10 @@ class UpdateFacultyRequest extends FormRequest
public function rules(): array
{
return [
'position' => 'int|max:255',
'position' => 'required|int|max:255',
'description' => 'string',
'slug' => 'required|string',
'educational_institution_id' => 'int',
'educational_institution_id' => 'required|int',
'name' => [
'required',
'string',

View File

@ -1,6 +1,6 @@
<?php
namespace App\Http\Requests;
namespace App\Http\Requests\admin;
use Illuminate\Foundation\Http\FormRequest;

View File

@ -1,6 +1,6 @@
<?php
namespace App\Http\Requests;
namespace App\Http\Requests\admin;
use Illuminate\Foundation\Http\FormRequest;