mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-25 21:54:14 -08:00
Eager load throttle query
This commit is contained in:
parent
64ffd261fc
commit
39450c1fe9
|
@ -876,7 +876,7 @@ class UsersController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
$users = User::select(array('users.id','users.employee_num','users.email','users.username','users.location_id','users.manager_id','users.first_name','users.last_name','users.created_at','users.notes','users.company_id', 'users.deleted_at','users.activated'))
|
$users = User::select(array('users.id','users.employee_num','users.email','users.username','users.location_id','users.manager_id','users.first_name','users.last_name','users.created_at','users.notes','users.company_id', 'users.deleted_at','users.activated'))
|
||||||
->with('assets', 'accessories', 'consumables', 'licenses', 'manager', 'groups', 'userloc', 'company');
|
->with('assets', 'accessories', 'consumables', 'licenses', 'manager', 'groups', 'userloc', 'company','throttle');
|
||||||
$users = Company::scopeCompanyables($users);
|
$users = Company::scopeCompanyables($users);
|
||||||
|
|
||||||
switch ($status) {
|
switch ($status) {
|
||||||
|
|
|
@ -232,10 +232,10 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon
|
||||||
|
|
||||||
public function accountStatus()
|
public function accountStatus()
|
||||||
{
|
{
|
||||||
if ($this->sentryThrottle) {
|
if ($this->throttle) {
|
||||||
if ($this->sentryThrottle->suspended==1) {
|
if ($this->throttle->suspended==1) {
|
||||||
return 'suspended';
|
return 'suspended';
|
||||||
} elseif ($this->sentryThrottle->banned==1) {
|
} elseif ($this->throttle->banned==1) {
|
||||||
return 'banned';
|
return 'banned';
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
@ -262,7 +262,7 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon
|
||||||
->orderBy('created_at', 'desc');
|
->orderBy('created_at', 'desc');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function sentryThrottle()
|
public function throttle()
|
||||||
{
|
{
|
||||||
return $this->hasOne('\App\Models\Throttle');
|
return $this->hasOne('\App\Models\Throttle');
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue