2022-07-29 06:06:19 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Requests;
|
|
|
|
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
2024-08-10 12:17:21 +00:00
|
|
|
use Illuminate\Support\Facades\Gate;
|
2024-08-10 00:14:47 +00:00
|
|
|
use Illuminate\Validation\Rule;
|
2022-07-29 06:06:19 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Editing Suppliers
|
|
|
|
*/
|
|
|
|
class CheckoutAddEdit extends FormRequest
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Determine if the user is authorized to make this request.
|
|
|
|
*
|
|
|
|
* @return bool
|
|
|
|
*/
|
|
|
|
public function authorize()
|
|
|
|
{
|
2024-08-10 12:17:21 +00:00
|
|
|
return Gate::allows('wholesaler');
|
2022-07-29 06:06:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the validation rules that apply to the request.
|
|
|
|
*
|
|
|
|
* @return array<string, mixed>
|
|
|
|
*/
|
|
|
|
public function rules()
|
|
|
|
{
|
|
|
|
return [
|
2024-08-10 00:14:47 +00:00
|
|
|
'name' => [
|
|
|
|
'required',
|
|
|
|
'string',
|
|
|
|
'min:2',
|
|
|
|
'max:255',
|
|
|
|
Rule::unique('checkouts','name')->ignore($this->route('o')?->id),
|
|
|
|
],
|
2022-07-29 06:06:19 +00:00
|
|
|
'active' => 'sometimes|accepted',
|
|
|
|
'description' => 'nullable|string|min:2|max:255',
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|