refactoring Requests max characters and numeric field
This commit is contained in:
parent
6954e296d6
commit
e7818471db
|
@ -15,11 +15,11 @@ class StoreDepartmentRequest extends FormRequest
|
|||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'position' => 'required|int|max:255',
|
||||
'position' => 'required|int|numeric|max:255',
|
||||
'name' => 'required|string|max:255|unique:departments,name',
|
||||
'description' => 'string',
|
||||
'slug' => 'required|string',
|
||||
'faculty_id' => 'required|int',
|
||||
'slug' => 'required|string|max:255',
|
||||
'faculty_id' => 'required|numeric|int|max:1000',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,13 +14,13 @@ class StoreDirectionRequest extends FormRequest
|
|||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'position' => 'required|int|max:255',
|
||||
'position' => 'required|int|numeric|max:255',
|
||||
'name' => 'required|string|max:255|unique:directions,name',
|
||||
'description' => 'string',
|
||||
'slug' => 'required|string',
|
||||
'code' => 'required|string',
|
||||
'education_level_id' => 'required|int',
|
||||
'department_id' => 'required|int'
|
||||
'slug' => 'required|string|max:255',
|
||||
'code' => 'required|string|max:255',
|
||||
'education_level_id' => 'required|int|numeric|max:1000',
|
||||
'department_id' => 'required|numeric|int|max:1000'
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ class StoreEducationLevelRequest extends FormRequest
|
|||
return [
|
||||
'name' => 'required|string|max:255|unique:education_levels,name',
|
||||
'description' => 'string',
|
||||
'slug' => 'required|string',
|
||||
'slug' => 'required|string|max:255',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,10 +14,10 @@ class StoreEducationalInstitutionRequest extends FormRequest
|
|||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'position' => 'required|int|max:255',
|
||||
'position' => 'required|int|numeric|max:255',
|
||||
'name' => 'required|string|max:255|unique:educational_institutions,name',
|
||||
'description' => 'string',
|
||||
'slug' => 'required|string',
|
||||
'slug' => 'required|string|max:255',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,11 +15,11 @@ class StoreFacultyRequest extends FormRequest
|
|||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'position' => 'required|int|max:255',
|
||||
'position' => 'required|int|numeric|max:255',
|
||||
'name' => 'required|string|max:255|unique:faculties,name',
|
||||
'description' => 'string',
|
||||
'slug' => 'required|string',
|
||||
'educational_institution_id' => 'required|int'
|
||||
'slug' => 'required|string|max:255',
|
||||
'educational_institution_id' => 'required|int|numeric|max:1000'
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,10 +13,10 @@ class UpdateDepartmentRequest extends FormRequest
|
|||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'position' => 'required|int|max:255',
|
||||
'position' => 'required|int|numeric|max:255',
|
||||
'description' => 'string',
|
||||
'slug' => 'string|required',
|
||||
'faculty_id' => 'int|required',
|
||||
'slug' => 'string|required|max:255',
|
||||
'faculty_id' => 'int|required|numeric|max:255',
|
||||
'name' => [
|
||||
'required',
|
||||
'string',
|
||||
|
|
|
@ -15,12 +15,12 @@ class UpdateDirectionRequest extends FormRequest
|
|||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'position' => 'required|int|max:255',
|
||||
'position' => 'required||numeric|int|max:255',
|
||||
'description' => 'string',
|
||||
'department_id' => 'int|required',
|
||||
'slug' => 'required|string',
|
||||
'code' => 'required|string',
|
||||
'education_level_id' => 'required|int',
|
||||
'department_id' => 'int|required|numeric|max:1000',
|
||||
'slug' => 'required|string|max:255',
|
||||
'code' => 'required|string|max:255',
|
||||
'education_level_id' => 'required|int|numeric|max:1000',
|
||||
'name' => [
|
||||
'required',
|
||||
'string',
|
||||
|
|
|
@ -16,7 +16,7 @@ class UpdateEducationLevelRequest extends FormRequest
|
|||
return [
|
||||
'name' => "required|string|max:255|unique:education_levels,name,{$this->education_level->id}",
|
||||
'description' => 'string',
|
||||
'slug' => 'required|string',
|
||||
'slug' => 'required|string|max:255',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,9 +15,9 @@ class UpdateEducationalInstitutionRequest extends FormRequest
|
|||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'position' => 'required|int|max:255',
|
||||
'position' => 'required|int|numeric|max:255',
|
||||
'description' => 'string',
|
||||
'slug' => 'required|string',
|
||||
'slug' => 'required|string|max:255',
|
||||
'name' => [
|
||||
'required',
|
||||
'string',
|
||||
|
|
|
@ -14,10 +14,10 @@ class UpdateFacultyRequest extends FormRequest
|
|||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'position' => 'required|int|max:255',
|
||||
'position' => 'required|int|numeric|max:255',
|
||||
'description' => 'string',
|
||||
'slug' => 'required|string',
|
||||
'educational_institution_id' => 'required|int',
|
||||
'slug' => 'required|string|max:255',
|
||||
'educational_institution_id' => 'required|int|numeric|max:255',
|
||||
'name' => [
|
||||
'required',
|
||||
'string',
|
||||
|
|
|
@ -14,10 +14,10 @@ class StoreAdmissionRequest extends FormRequest
|
|||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'position' => 'required|int|max:255',
|
||||
'position' => 'required|int|numeric|max:255',
|
||||
'name' => 'required|string|max:255|unique:admissions,name',
|
||||
'description' => 'string',
|
||||
'slug' => 'required|string',
|
||||
'slug' => 'required|string|max:255',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,11 +15,11 @@ class StoreDocumentRequest extends FormRequest
|
|||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'name' => 'required|max:255',
|
||||
'name' => 'required|string|max:255',
|
||||
'description' => 'string',
|
||||
'position' => 'required|int|max:255',
|
||||
'position' => 'required|int|numeric|max:255',
|
||||
'document' => 'required|file',
|
||||
'admission_id' => 'required|int|max:255',
|
||||
'admission_id' => 'required|int|numeric|max:1000',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,26 +6,16 @@ use Illuminate\Foundation\Http\FormRequest;
|
|||
|
||||
class StoreUserRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'name' => 'required|unique:users,name|max:255',
|
||||
'email' => 'email',
|
||||
'email' => 'email|string|max:255',
|
||||
'password' => 'required'
|
||||
];
|
||||
}
|
||||
|
|
|
@ -14,9 +14,9 @@ class UpdateAdmissionRequest extends FormRequest
|
|||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'position' => 'required|int|max:255',
|
||||
'position' => 'required|int|numeric|max:255',
|
||||
'description' => 'string',
|
||||
'slug' => 'string|required',
|
||||
'slug' => 'string|required|max:255',
|
||||
'name' => [
|
||||
'required',
|
||||
'string',
|
||||
|
|
|
@ -20,9 +20,9 @@ class UpdateDocumentRequest extends FormRequest
|
|||
'max:255',
|
||||
"unique:documents,name,{$this->document->id}",
|
||||
],
|
||||
'position' => 'required|int|max:255',
|
||||
'position' => 'required|int|numeric|max:255',
|
||||
'description' => 'string',
|
||||
'admission_id' => 'required|int|max:255',
|
||||
'admission_id' => 'required|int|numeric|max:1000',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,9 +24,9 @@ class UpdateUserRequest extends FormRequest
|
|||
public function rules()
|
||||
{
|
||||
return [
|
||||
'name' => 'required|max:255',
|
||||
'email' => 'email',
|
||||
'password' => 'required'
|
||||
'name' => 'required|string|max:255',
|
||||
'email' => 'email|string|max:255',
|
||||
'password' => 'required|max:255'
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue