mirror of
https://github.com/Bigherollc/wticreatorstudio.git
synced 2026-08-01 08:16:55 -04:00
75 lines
2.0 KiB
PHP
75 lines
2.0 KiB
PHP
<?php
|
|
|
|
namespace Modules\JobPortal\Entities;
|
|
|
|
use App\Models\User as UserModel;
|
|
|
|
class User extends UserModel
|
|
{
|
|
public function getAvatarUrl()
|
|
{
|
|
if (!empty($this->avatar)) {
|
|
return showImage($row->user->avatar);
|
|
}
|
|
|
|
return showImage('frontend/default/img/avatar.jpg');
|
|
}
|
|
|
|
public function getDisplayName($email = false)
|
|
{
|
|
$name = $this->name ?? "";
|
|
if (!empty($this->first_name) or !empty($this->last_name)) {
|
|
$name = implode(' ', [$this->first_name, $this->last_name]);
|
|
}
|
|
if (!empty($this->business_name)) {
|
|
$name = $this->business_name;
|
|
}
|
|
if (!trim($name) and $this->email) $name = $this->email;
|
|
if (empty(trim($name))) {
|
|
$name = '';
|
|
}
|
|
return $name;
|
|
}
|
|
|
|
public function getDisplayNameAttribute()
|
|
{
|
|
$name = $this->name;
|
|
if (!empty($this->first_name) or !empty($this->last_name)) {
|
|
$name = implode(' ', [$this->first_name, $this->last_name]);
|
|
}
|
|
if (!empty($this->business_name)) {
|
|
$name = $this->business_name;
|
|
}
|
|
return $name;
|
|
}
|
|
|
|
public function company()
|
|
{
|
|
return $this->hasOne('Modules\JobPortalCompany\Entities\Company', 'owner_id', 'id');
|
|
}
|
|
|
|
public function candidate()
|
|
{
|
|
return $this->hasOne('Modules\JobPortalCandidate\Entities\Candidate', 'id', 'id');
|
|
}
|
|
|
|
public function gigs()
|
|
{
|
|
return $this->hasMany('Modules\JobPortalGig\Entities\Gig', 'author_id', 'id');
|
|
}
|
|
|
|
public function gigsPublish()
|
|
{
|
|
return $this->hasMany('Modules\JobPortalGig\Entities\Gig', 'author_id', 'id')->where('status','publish');
|
|
}
|
|
|
|
public function checkCompanyInfo() {
|
|
if(empty($this->company)) return false;
|
|
if(empty($this->company->name)) return false;
|
|
if(empty($this->company->phone)) return false;
|
|
if(empty($this->company->email)) return false;
|
|
|
|
return true;
|
|
}
|
|
}
|