refactoring requests rules
This commit is contained in:
parent
3e50dee628
commit
968a4b06c8
|
@ -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',
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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',
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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',
|
||||||
|
|
|
@ -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'
|
||||||
|
|
|
@ -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',
|
||||||
|
|
|
@ -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'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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}",
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -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}",
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -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' => [
|
||||||
|
|
|
@ -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',
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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;
|
||||||
|
|
Loading…
Reference in New Issue