| Current Path : /home/users/unlimited/www/dabbawali.sizzlingcafe.co.in/app/Http/Requests/ |
| Current File : /home/users/unlimited/www/dabbawali.sizzlingcafe.co.in/app/Http/Requests/CustomerRequest.php |
<?php
namespace App\Http\Requests;
use App\Rules\ValidPhone;
use Illuminate\Validation\Rule;
use Illuminate\Foundation\Http\FormRequest;
class CustomerRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'name' => ['required', 'string', 'max:190'],
'email' => [
'required',
'email',
'max:190',
Rule::unique("users", "email")->ignore($this->route('customer.id'))
],
'password' => [
$this->route('customer.id') ? 'nullable' : 'required',
'string',
'min:6',
'confirmed'
],
'username' => [
'nullable',
'max:190',
Rule::unique("users", "username")->ignore($this->route('customer.id'))
],
'device_token' => ['nullable', 'string'],
'web_token' => ['nullable', 'string'],
'password_confirmation' => [$this->route('customer.id') ? 'nullable' : 'required', 'string', 'min:6'],
'phone' => [
'nullable',
'string',
'max:20',
new ValidPhone(),
Rule::unique("users", "phone")->ignore($this->route('customer.id'))
],
'branch_id' => ['nullable', 'numeric'],
'status' => ['required', 'numeric', 'max:24'],
'country_code' => ['required', 'string', 'max:20'],
];
}
}