dstpabuaran.com/app/Http/Requests/Admin/Master/CustomerRequest.php

35 lines
784 B
PHP

<?php
namespace App\Http\Requests\Admin\Master;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
class CustomerRequest extends FormRequest
{
public function authorize(): bool
{
return true;
}
public function rules(): array
{
$customer = $this->route('customer');
return [
'name' => ['required', 'string', 'max:200', Rule::unique('customers', 'name')->ignore($customer)],
'phone_number' => ['nullable', 'string', 'max:20'],
'address' => ['nullable', 'string'],
];
}
public function attributes(): array
{
return [
'name' => 'nama',
'phone_number' => 'nomor telepon',
'address' => 'alamat',
];
}
}