38 lines
917 B
PHP
38 lines
917 B
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Bo;
|
|
|
|
use App\Enums\CustomerTypeEnum;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Illuminate\Validation\Rules\Enum;
|
|
|
|
class UpdateCustomerRequest extends FormRequest
|
|
{
|
|
/**
|
|
* Determine if the user is authorized to make this request.
|
|
*
|
|
* @return boolean
|
|
*/
|
|
public function authorize()
|
|
{
|
|
return auth('backend')->check();
|
|
}
|
|
|
|
/**
|
|
* Get the validation rules that apply to the request.
|
|
*
|
|
* @return array
|
|
*/
|
|
public function rules()
|
|
{
|
|
return [
|
|
'tc_id' => 'nullable|digits_between:1,16',
|
|
'client_number' => [
|
|
!empty($this->customer->client_number) ? 'required' : 'nullable',
|
|
'digits_between:1,16'
|
|
],
|
|
'phone' => 'nullable|string|max:15',
|
|
'role' => ['required', new Enum(CustomerTypeEnum::class)]
|
|
];
|
|
}
|
|
}
|