init project

This commit is contained in:
2026-05-25 11:08:52 +07:00
commit 85c4b769cc
417 changed files with 67702 additions and 0 deletions

View File

@@ -0,0 +1,92 @@
<?php
namespace App\Http\Requests\Auth;
use Illuminate\Auth\Events\Lockout;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\RateLimiter;
use Illuminate\Support\Str;
use Illuminate\Validation\ValidationException;
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
*/
public function rules()
{
return [
'email' => ['required', 'string', 'email'],
'password' => ['required', 'string'],
];
}
/**
* Attempt to authenticate the request's credentials.
*
* @return void
*
* @throws \Illuminate\Validation\ValidationException
*/
public function authenticate()
{
$this->ensureIsNotRateLimited();
if (! Auth::attempt($this->only('email', 'password'), $this->boolean('remember'))) {
RateLimiter::hit($this->throttleKey());
throw ValidationException::withMessages([
'email' => trans('auth.failed'),
]);
}
RateLimiter::clear($this->throttleKey());
}
/**
* Ensure the login request is not rate limited.
*
* @return void
*
* @throws \Illuminate\Validation\ValidationException
*/
public function ensureIsNotRateLimited()
{
if (! RateLimiter::tooManyAttempts($this->throttleKey(), 5)) {
return;
}
event(new Lockout($this));
$seconds = RateLimiter::availableIn($this->throttleKey());
throw ValidationException::withMessages([
'email' => trans('auth.throttle', [
'seconds' => $seconds,
'minutes' => ceil($seconds / 60),
]),
]);
}
/**
* Get the rate limiting throttle key for the request.
*
* @return string
*/
public function throttleKey()
{
return Str::lower($this->input('email')).'|'.$this->ip();
}
}

View File

@@ -0,0 +1,43 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Log;
class PatientCreateRequest 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()
{
//Log::info($this->request->all());
return [
'name_en' => 'required|string',
'patient_uuid' => 'nullable|string',
'dob' => 'required|date',
'gender' => 'required|integer',
'phone_number' => 'nullable',
'khid_number' => 'nullable',
'house_number' => 'nullable',
'street_number' => 'nullable',
'province_id' => 'nullable',
'district_id' => 'nullable',
'commune_id' => 'nullable',
'village_id' => 'nullable'
];
}
}

View File

@@ -0,0 +1,42 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class PatientTypeCreateRequest 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 [
'name_en' => 'required',
'gender' => 'required',
'age_from' => 'required|min:0',
'age_from_unit' => 'required|min:0',
'age_to' => 'required|min:0',
'age_to_unit' => 'required|min:0'
];
}
public function messages()
{
return [
];
}
}

View File

@@ -0,0 +1,43 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class PatientUpdateRequest 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 [
'uid' => 'required|integer|min:1',
'name_en' => 'required|string',
'patient_uuid' => 'nullable|string',
'dob' => 'required',
'gender' => 'required|integer',
'phone_number' => 'nullable',
'khid_number' => 'nullable',
'house_number' => 'nullable',
'street_number' => 'nullable',
'province_id' => 'nullable',
'district_id' => 'nullable',
'commune_id' => 'nullable',
'village_id' => 'nullable'
];
}
}

View File

@@ -0,0 +1,106 @@
<?php
namespace App\Http\Requests;
use App\Models\Sample;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
use Illuminate\Validation\Rules\Unique;
class SampleCreateRequest 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 [
'patient_id' => 'required|integer|min:1',
/*'sample_number' => [
'required',
Rule::unique(Sample::getTableNameByConnection(), 'sample_number')
],*/
'physician_id' => 'required|integer',
'sample_source_id' => 'required|integer',
'sample_condition' => 'nullable',
'reject_comment_id' => 'nullable',
'collected_date' => 'required|date',
'received_date' => 'required|date',
'admission_date' => 'required|date',
'diagnosis' => 'nullable',
'is_urgent' => 'required|integer'
];
}
public function messages()
{
return [
//'reject_comment_id.required_if' => 'Reject reason is required.'
];
}
}

View File

@@ -0,0 +1,33 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class SampleDetailCreateRequest 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 [
'sample_id' => 'required|integer|min:1',
'sample_tests' => 'required|array',
'sample_details' => 'required|array'
];
}
}

View File

@@ -0,0 +1,41 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class TestSampleCreateRequest 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 [
'test_id' => 'required|integer|min:1',
'sample_type_id' => 'required|integer|min:1',
'group_result' => 'nullable|string',
'unit_sign' => 'nullable|string',
'heading_id' => 'nullable',
'usd_price' => 'nullable',
'code' => 'nullable',
'wight' => 'nullable',
'filed_type_id' => 'required|integer|min:0',
//'patient_type_ids' => 'required_if:filed_type_id,1',
//'organisms' => 'required_if:filed_type_id,2,3'
];
}
}

View File

@@ -0,0 +1,91 @@
<?php
namespace App\Http\Requests\UpdateRequests;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Http\Request;
class SampleUpdateRequest 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 [
'physician_id' => 'required|integer',
'sample_source_id' => 'required|integer',
//'sample_condition' => 'nullable',
//'reject_comment_id' => 'nullable',
'collected_date' => 'required|date',
'received_date' => 'required|date',
'admission_date' => 'required|date',
//'diagnosis' => 'nullable',
//'is_urgent' => 'accepted'
];
}
public function messages()
{
return [
];
}
}

View File

@@ -0,0 +1,39 @@
<?php
namespace App\Http\Requests\UpdateRequests;
use Illuminate\Foundation\Http\FormRequest;
class TestSampleUpdateRequest 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 [
'uid' => 'required',
'test_id' => 'required|integer|min:1',
'sample_type_id' => 'required|integer|min:1',
'group_result' => 'nullable|string',
'heading_id' => 'nullable',
'unit_sign' => 'nullable|string',
'usd_price' => 'nullable',
'wight' => 'nullable',
'filed_type_id' => 'required|integer|min:0',
];
}
}