osb/app/Http/Requests/ServiceChange.php
Deon George 283ae06a5c
All checks were successful
Create Docker Image / Build Docker Image (x86_64) (push) Successful in 32s
Create Docker Image / Final Docker Image Manifest (push) Successful in 9s
Fixes for service change, validation added for date and product_id
2024-08-17 15:15:15 +10:00

45 lines
780 B
PHP

<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Gate;
use Illuminate\Validation\Rule;
/**
* Editing Suppliers
*/
class ServiceChange extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return Gate::allows('view',$this->route('o'));
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, mixed>
*/
public function rules()
{
return [
'change_date'=> [
'required',
'date',
'after:today',
],
'product_id' => [
'required',
'exists:products,id',
Rule::notIn([request()->route('o')->product_id]),
],
'notes' => 'nullable|min:5',
];
}
}