Updates to login home
This commit is contained in:
@@ -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 = [];
|
||||
|
Reference in New Issue
Block a user