Updates to login home

This commit is contained in:
Deon George
2018-08-09 09:33:51 +10:00
parent b9cf666581
commit ca402df525
12 changed files with 166 additions and 39 deletions

View File

@@ -11,11 +11,15 @@ class Account extends Model
protected $appends = [
'active_display',
'services_count_html',
'switch_url',
];
protected $visible = [
'id',
'company',
'active_display',
'services_count_html',
'switch_url',
];
/**
@@ -31,6 +35,11 @@ class Account extends Model
return $this->belongsTo(Language::class);
}
public function services()
{
return $this->hasMany(Service::class);
}
public function user()
{
return $this->belongsTo(\App\User::class);
@@ -56,6 +65,16 @@ class Account extends Model
return sprintf('<a href="/r/account/view/%s">%s</a>',$this->id,$this->account_id);
}
public function getServicesCountHtmlAttribute()
{
return sprintf('%s <small>/%s</small>',$this->services->where('active',TRUE)->count(),$this->services->count());
}
public function getSwitchUrlAttribute()
{
return sprintf('<a href="/a/switch/start/%s"><i class="fa fa-external-link"></i></a>',$this->user_id);
}
private function _address()
{
$return = [];