mirror of
https://github.com/Bigherollc/wticreatorstudio.git
synced 2026-08-01 17:17:12 -04:00
37 lines
872 B
PHP
37 lines
872 B
PHP
<?php
|
|
namespace Modules\Customer\Traits;
|
|
use Illuminate\Database\Eloquent\Casts\Attribute;
|
|
use Illuminate\Support\Facades\DB;
|
|
use Modules\Customer\Entities\UserAdditionalContact;
|
|
use Modules\Customer\Entities\UserCompany;
|
|
use App\Models\User;
|
|
|
|
trait CustomerTrait
|
|
{
|
|
public function referrer(){
|
|
return $this->hasOne(User::class,'id','referrer_id');
|
|
}
|
|
|
|
public function company()
|
|
{
|
|
return $this->hasOne(UserCompany::class, 'user_id', 'id');
|
|
}
|
|
|
|
public function additionalContacts(){
|
|
return $this->hasMany(UserAdditionalContact::class,'user_id');
|
|
}
|
|
|
|
public function getCompanyDetailsAttribute()
|
|
{
|
|
if($this->wti_data == null){
|
|
return [
|
|
'brand_name' => null,
|
|
'storefront' => null
|
|
];
|
|
}
|
|
|
|
return json_decode($this->wti_data, true);
|
|
}
|
|
|
|
}
|