Merge pull request #104 from witelgroup/feature/PaymentHarimCheckServise

Write webservice for harim and Cmms
This commit is contained in:
Amir Ghasempoor
2025-12-20 10:57:32 +03:30
committed by GitHub
10 changed files with 209 additions and 4 deletions

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Http\Requests\V3\Dashboard\Harim\Detail;
use App\Enums\HarimStates;
use Illuminate\Contracts\Validation\ValidationRule;
use Illuminate\Foundation\Http\FormRequest;
class HarimSubmitInvoiceRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return $this->harim->state_id == HarimStates::SABT_FISH->value;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, ValidationRule|array|string>
*/
public function rules(): array
{
return [
//
];
}
}

View File

@@ -36,13 +36,13 @@ class AllocateRequest extends FormRequest
return [
function (Validator $validator) {
$duplicateMission = Mission::query()->where('machine_id', '=', $this->machine_id)
->whereBetween('start_date', [$this->mission->start_date, $this->mission->end_date])
->orWhereBetween('end_date', [$this->mission->start_date, $this->mission->end_date])
->where('start_date', '<=', $this->mission->end_date)
->where('end_date', '>=', $this->mission->start_date)
->exists();
if ($duplicateMission) {
$validator->errors()->add(
'machine',
'machine_id',
'خودروی مورد نظر در این زمان رزرو می باشد'
);
}