osb/app/Http/Requests/CheckoutAddEdit.php

43 lines
780 B
PHP
Raw Permalink Normal View History

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