['required', 'string', 'max:50'], 'phone_number' => ['nullable', 'string', new PhoneNumber], 'gender' => ['required', Rule::in(Gender::cases())], ]; } public function validationAttributes(): array { return [ 'name' => 'nama', 'phone_number' => 'nomor telepon', 'gender' => 'jenis kelamin', ]; } public function setCustomer(Customer $customer) { $this->customer = $customer; $this->name = $customer->name; $this->phone_number = $customer->phone_number; $this->gender = $customer->gender->value; } public function store() { $this->validate(); Customer::create([ 'user_id' => $this->user_id, 'name' => $this->name, 'phone_number' => $this->phone_number, 'gender' => $this->gender, ]); } public function update() { $this->validate(); $this->customer->update([ 'name' => $this->name, 'phone_number' => $this->phone_number, 'gender' => $this->gender, ]); } }