*/ public function rules() { return [ 'name' => 'string', 'birth_place' => 'string', 'birth_date' => 'date', 'gender' => 'string', 'phone' => 'numeric', 'email' => 'email', 'blood_type' => 'string', 'weight' => 'string', 'height' => 'string', 'relation_with_owner' => 'string', // relasi family table 'marital_status' => 'string', 'religion' => 'string', 'last_education' => 'string', 'current_employment' => 'string', 'nik' => 'string|min:16|max:16', 'updated_by' => 'integer', 'user_avatar' => 'file', // relasi file table 'verification_file' => 'file', // relasi file table 'is_ktp' => 'boolean', 'citizenship' => 'string', ]; } /** * Prepare the data for validation. * * @return void */ protected function prepareForValidation() { $citizenship = $this->is_ktp ? 'wni' : 'wna'; $this->merge([ 'birth_date' => empty($this->birth_date) ? $this->birth_date . " 00:00:00" : $this->birth_date, 'updated_by' => auth()->user()->id, 'citizenship' => $citizenship ? $citizenship : NULL ]); } }