Initial reseller domain report, enable editing domain service details
This commit is contained in:
@@ -74,6 +74,8 @@ class User extends Authenticatable
|
||||
'customer',
|
||||
];
|
||||
|
||||
/* RELATIONS */
|
||||
|
||||
/**
|
||||
* The accounts that this user manages
|
||||
*
|
||||
@@ -175,7 +177,7 @@ class User extends Authenticatable
|
||||
return $this->hasMany(static::class,'parent_id','id');
|
||||
}
|
||||
|
||||
/** ATTRIBUTES **/
|
||||
/* ATTRIBUTES */
|
||||
|
||||
public function getActiveDisplayAttribute($value)
|
||||
{
|
||||
@@ -268,6 +270,8 @@ class User extends Authenticatable
|
||||
return sprintf('<a href="/u/account/view/%s">%s</a>',$this->id,$this->user_id);
|
||||
}
|
||||
|
||||
/* METHODS */
|
||||
|
||||
/**
|
||||
* Users password reset email notification
|
||||
*
|
||||
@@ -278,7 +282,7 @@ class User extends Authenticatable
|
||||
$this->notify((new ResetPasswordNotification($token))->onQueue('high'));
|
||||
}
|
||||
|
||||
/** SCOPES */
|
||||
/* SCOPES */
|
||||
|
||||
// @todo use trait
|
||||
public function scopeActive()
|
||||
@@ -323,6 +327,8 @@ class User extends Authenticatable
|
||||
return $query;
|
||||
}
|
||||
|
||||
/* GENERAL METHODS */
|
||||
|
||||
/**
|
||||
* Determine if the user is an admin of the account with $id
|
||||
*
|
||||
@@ -334,8 +340,6 @@ class User extends Authenticatable
|
||||
return $id AND $this->isReseller() AND in_array($id,$this->all_accounts()->pluck('id')->toArray());
|
||||
}
|
||||
|
||||
/** FUNCTIONS */
|
||||
|
||||
/**
|
||||
* Get a list of accounts for the clients of this user
|
||||
*
|
||||
@@ -437,8 +441,8 @@ class User extends Authenticatable
|
||||
public function client_service_movements(): DatabaseCollection
|
||||
{
|
||||
return Service::active()
|
||||
->authorised($this)
|
||||
->where('order_status','!=','ACTIVE')
|
||||
->whereIN('account_id',$this->all_accounts()->pluck('id')->unique()->toArray())
|
||||
->with(['account','product'])
|
||||
->get();
|
||||
}
|
||||
@@ -630,6 +634,14 @@ class User extends Authenticatable
|
||||
->from($payment,'summary');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine what the logged in user's role is
|
||||
* + Wholesaler - aka Super User
|
||||
* + Reseller - services accounts on behalf of their customers
|
||||
* + Customer - end user customer
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function role()
|
||||
{
|
||||
// If I have agents and no parent, I am the wholesaler
|
||||
|
Reference in New Issue
Block a user