Untitled
user_6710311
plain_text
2 years ago
1.2 kB
12
Indexable
<?php
namespace App\Models\Wordpress;
use Corcel\Model\User;
use Illuminate\Database\Eloquent\Factories\HasFactory;
class WPUser extends User
{
use HasFactory;
protected $hidden = ['meta'];
protected $appends = ['address1', 'address2', 'phone', 'companyName'];
public function getAddress1Attribute()
{
foreach ($this->meta as $value) {
if ($value->meta_key == 'billing_address_1') {
return $value->meta_value;
}
}
return '';
}
public function getAddress2Attribute()
{
foreach ($this->meta as $value) {
if ($value->meta_key == 'billing_address_2') {
return $value->meta_value;
}
}
return '';
}
public function getPhoneAttribute()
{
foreach ($this->meta as $value) {
if ($value->meta_key == 'billing_phone') {
return $value->meta_value;
}
}
return '';
}
function getCompanyNameAttribute() {
foreach ($this->meta as $value) {
if ($value->meta_key == 'nickname_7') {
return $value->meta_value;
}
}
return '';
}
}
Editor is loading...
Leave a Comment