Files
portal-api/app/Http/Requests/CreateCustomerRequest.php
T
baodev0andClaude Sonnet 5.5 e1ffbf52fe fix(customer): lưu và trả địa chỉ khách hàng
Bảng customers chỉ có cột address nên address_1/address_2 từ form admin bị bỏ khi validate.
Thêm cột address_2, fillable, rule validate và trả đủ field địa chỉ trong CustomerResource.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-27 08:37:57 +07:00

42 lines
1.2 KiB
PHP

<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class CreateCustomerRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
'fullname' => 'required',
'email' => 'required|email',
'password' => $this->isMethod('post') ? 'required|min:6' : 'nullable|min:6',
'status' => 'nullable|integer|in:0,1,2,3',
'company' => 'nullable',
'phone' => 'nullable',
'address' => 'nullable|string|max:255',
'address_2' => 'nullable|string|max:255',
'city' => 'nullable',
'state' => 'nullable',
'postcode' => 'nullable',
'country' => 'nullable',
'email_marketing' => 'nullable|boolean',
'note' => 'nullable|string',
];
}
}