refactoring requests rules
Tests & Lint & Deploy to Railway / build (2.6.6, 20.x, 8.3) (push) Failing after 1m47s Details
Tests & Lint & Deploy to Railway / deploy (push) Has been skipped Details

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 [ return [
'position' => 'required|int|max:255', 'position' => 'required|int|max:255',
'name' => 'required|string|max:255|unique:educational_institutions,name', 'name' => 'required|string|max:255|unique:departments,name',
'description' => 'string', 'description' => 'string',
'slug' => 'required|string', 'slug' => 'required|string',
'faculty_id' => 'required|int', 'faculty_id' => 'required|int',

View File

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

View File

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

View File

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

View File

@ -21,7 +21,7 @@ class UpdateDepartmentRequest extends FormRequest
'required', 'required',
'string', 'string',
'max:255', '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 public function rules(): array
{ {
return [ return [
'position' => 'int|max:255', 'position' => 'required|int|max:255',
'description' => 'string', 'description' => 'string',
'department_id' => 'int|required', 'department_id' => 'int|required',
'slug' => 'required|string', 'slug' => 'required|string',
@ -23,7 +23,7 @@ class UpdateDirectionRequest extends FormRequest
'required', 'required',
'string', 'string',
'max:255', '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 public function rules(): array
{ {
return [ return [
'position' => 'int|max:255', 'position' => 'required|int|max:255',
'description' => 'string', 'description' => 'string',
'slug' => 'required|string', 'slug' => 'required|string',
'name' => [ 'name' => [

View File

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

View File

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

View File

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