| @@ -44,8 +44,10 @@ | ||
| 44 | 44 | 'last_name', |
| 45 | 45 | 'full_name', |
| 46 | 46 | 'formatted_address', |
| 47 | 47 | 'company_name', |
| 48 | + 'vat_number', | |
| 49 | + 'legal_registration_id', | |
| 48 | 50 | 'phone', |
| 49 | 51 | 'label' |
| 50 | 52 | ]; |
| 51 | 53 | |
| @@ -87,9 +89,9 @@ | ||
| 87 | 89 | $nameParts = explode(" ", $this->name ?? ''); |
| 88 | 90 | return end($nameParts); |
| 89 | 91 | } |
| 90 | 92 | |
| 91 | - public function order(): \FluentCart\Framework\Database\Orm\Relations\belongsTo | |
| 93 | + public function order(): \FluentCart\Framework\Database\Orm\Relations\BelongsTo | |
| 92 | 94 | { |
| 93 | 95 | return $this->belongsTo(Order::class, 'order_id', 'id'); |
| 94 | 96 | } |
| 95 | 97 | |
| @@ -176,9 +178,11 @@ | ||
| 176 | 178 | '' . $prefix . 'state' => $this->state, |
| 177 | 179 | '' . $prefix . 'phone' => $this->phone, |
| 178 | 180 | '' . $prefix . 'postcode' => $this->postcode, |
| 179 | 181 | '' . $prefix . 'country' => $this->country, |
| 180 | - '' . $prefix . 'company_name' => $this->company_name, | |
| 182 | + '' . $prefix . 'company_name' => $this->company_name, | |
| 183 | + '' . $prefix . 'vat_number' => $this->vat_number, | |
| 184 | + '' . $prefix . 'legal_registration_id' => $this->legal_registration_id, | |
| 181 | 185 | ]; |
| 182 | 186 | |
| 183 | 187 | if ($prefix === 'billing_') { |
| 184 | 188 | unset($data['billing_full_name']); |
| @@ -206,8 +210,44 @@ | ||
| 206 | 210 | |
| 207 | 211 | public function getCompanyNameAttribute() |
| 208 | 212 | { |
| 209 | 213 | return Arr::get($this->meta, 'other_data.company_name', ''); |
| 214 | + } | |
| 215 | + | |
| 216 | + public function setVatNumberAttribute($value) | |
| 217 | + { | |
| 218 | + $meta = is_array($this->meta) ? $this->meta : []; | |
| 219 | + | |
| 220 | + if ($value) { | |
| 221 | + Arr::set($meta, 'other_data.vat_number', $value); | |
| 222 | + } else { | |
| 223 | + unset($meta['other_data']['vat_number']); | |
| 224 | + } | |
| 225 | + | |
| 226 | + $this->attributes['meta'] = json_encode($meta); | |
| 227 | + } | |
| 228 | + | |
| 229 | + public function getVatNumberAttribute() | |
| 230 | + { | |
| 231 | + return Arr::get($this->meta, 'other_data.vat_number', ''); | |
| 232 | + } | |
| 233 | + | |
| 234 | + public function setLegalRegistrationIdAttribute($value) | |
| 235 | + { | |
| 236 | + $meta = is_array($this->meta) ? $this->meta : []; | |
| 237 | + | |
| 238 | + if ($value) { | |
| 239 | + Arr::set($meta, 'other_data.legal_registration_id', $value); | |
| 240 | + } else { | |
| 241 | + unset($meta['other_data']['legal_registration_id']); | |
| 242 | + } | |
| 243 | + | |
| 244 | + $this->attributes['meta'] = json_encode($meta); | |
| 245 | + } | |
| 246 | + | |
| 247 | + public function getLegalRegistrationIdAttribute() | |
| 248 | + { | |
| 249 | + return Arr::get($this->meta, 'other_data.legal_registration_id', ''); | |
| 210 | 250 | } |
| 211 | 251 | |
| 212 | 252 | public function setLabelAttribute($value) |
| 213 | 253 | { |