initial commit
This commit is contained in:
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class BaseFormRequest 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
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return match($this->method()){
|
||||
'POST' => $this->store(),
|
||||
'PUT', 'PATCH' => $this->update(),
|
||||
'DELETE' => $this->destroy(),
|
||||
default => $this->index()
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the get request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the post request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function store()
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the put/patch request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function update()
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the delete request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function destroy()
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Validation\Rules\File;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class DiagnoseRequest extends BaseFormRequest
|
||||
{
|
||||
/**
|
||||
* Get the validation rules that apply to the post request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function store()
|
||||
{
|
||||
return [
|
||||
'diagnoses' => [
|
||||
Rule::in(['normal','warning','danger']),
|
||||
'required'
|
||||
],
|
||||
'file' => [
|
||||
'required',
|
||||
File::types(['mp3','wav'])
|
||||
->max(2 * 1024),
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the put/patch request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function update()
|
||||
{
|
||||
return [
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the delete request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function destroy()
|
||||
{
|
||||
return [
|
||||
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class DoctorRequest extends BaseFormRequest
|
||||
{
|
||||
/**
|
||||
* Get the validation rules that apply to the post request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function store()
|
||||
{
|
||||
return [
|
||||
'fullname' => 'required',
|
||||
'address' => 'required',
|
||||
'phone' => 'required',
|
||||
'emergency_phone' => 'required',
|
||||
'gender' => 'required',
|
||||
'age' => 'required',
|
||||
|
||||
// user
|
||||
'email' => 'required|email',
|
||||
'password' => 'required',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the put/patch request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function update()
|
||||
{
|
||||
return [
|
||||
'role' => [
|
||||
Rule::in(['admin','patient','doctor'])
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the delete request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function destroy()
|
||||
{
|
||||
return [
|
||||
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class LoginRequest 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 [
|
||||
'email' => 'email|required|string',
|
||||
'password' => 'required|string'
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class PatientRequest extends BaseFormRequest
|
||||
{
|
||||
/**
|
||||
* Get the validation rules that apply to the post request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function store()
|
||||
{
|
||||
return [
|
||||
'fullname' => 'required',
|
||||
'address' => 'required',
|
||||
'phone' => 'required',
|
||||
'emergency_phone' => 'required',
|
||||
'gender' => 'required',
|
||||
'age' => 'required',
|
||||
'device_id' => 'required',
|
||||
'condition' => 'required',
|
||||
|
||||
// user
|
||||
'email' => 'required|email',
|
||||
'password' => 'required',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the put/patch request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function update()
|
||||
{
|
||||
return [
|
||||
'role' => [
|
||||
Rule::in(['admin','patient','doctor'])
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the delete request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function destroy()
|
||||
{
|
||||
return [
|
||||
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user