Replaced custom deleted query scopes with onlyTrashed()

This commit is contained in:
snipe 2019-01-24 14:47:44 -08:00
parent ffc51d6db6
commit d1fe7abb18
5 changed files with 2 additions and 50 deletions

View file

@ -156,7 +156,7 @@ class AssetsController extends Controller
// I am sad. :( // I am sad. :(
switch ($request->input('status')) { switch ($request->input('status')) {
case 'Deleted': case 'Deleted':
$assets->withTrashed()->Deleted(); $assets->onlyTrashed();
break; break;
case 'Pending': case 'Pending':
$assets->join('status_labels AS status_alias',function ($join) { $assets->join('status_labels AS status_alias',function ($join) {

View file

@ -63,7 +63,7 @@ class UsersController extends Controller
if (($request->filled('deleted')) && ($request->input('deleted')=='true')) { if (($request->filled('deleted')) && ($request->input('deleted')=='true')) {
$users = $users->GetDeleted(); $users = $users->onlyTrashed();
} }
if ($request->filled('company_id')) { if ($request->filled('company_id')) {

View file

@ -1052,19 +1052,6 @@ class Asset extends Depreciable
} }
/**
* Query builder scope for Deleted assets
*
* @param \Illuminate\Database\Query\Builder $query Query builder instance
*
* @return \Illuminate\Database\Query\Builder Modified query builder
*/
public function scopeDeleted($query)
{
return $query->whereNotNull('assets.deleted_at');
}
/** /**
* scopeInModelList * scopeInModelList
* Get all assets in the provided listing of model ids * Get all assets in the provided listing of model ids

View file

@ -187,17 +187,6 @@ class AssetModel extends SnipeModel
* ----------------------------------------------- * -----------------------------------------------
**/ **/
/**
* Query builder scope for Deleted assets
*
* @param \Illuminate\Database\Query\Builder $query Query builder instance
* @return \Illuminate\Database\Query\Builder Modified query builder
*/
public function scopeDeleted($query)
{
return $query->whereNotNull('deleted_at');
}
/** /**
* scopeInCategory * scopeInCategory

View file

@ -440,18 +440,6 @@ class User extends SnipeModel implements AuthenticatableContract, AuthorizableCo
return $this->belongsToMany(Asset::class, 'checkout_requests', 'user_id', 'requestable_id')->whereNull('canceled_at'); return $this->belongsToMany(Asset::class, 'checkout_requests', 'user_id', 'requestable_id')->whereNull('canceled_at');
} }
/**
* Query builder scope to return deleted users
* @author A. Gianotto <snipe@snipe.net>
* @since [v2.0]
*
* @param string $query
* @return \Illuminate\Database\Query\Builder
*/
public function scopeGetDeleted($query)
{
return $query->withTrashed()->whereNotNull('users.deleted_at');
}
/** /**
* Query builder scope to return NOT-deleted users * Query builder scope to return NOT-deleted users
@ -591,18 +579,6 @@ class User extends SnipeModel implements AuthenticatableContract, AuthorizableCo
}); });
} }
/**
* Query builder scope for Deleted users
*
* @param \Illuminate\Database\Query\Builder $query Query builder instance
* @return \Illuminate\Database\Query\Builder Modified query builder
*/
public function scopeDeleted($query)
{
return $query->whereNotNull('deleted_at');
}
/** /**
* Query builder scope to order on manager * Query builder scope to order on manager