mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-11 05:47:28 -08:00
Replaced custom deleted query scopes with onlyTrashed()
This commit is contained in:
parent
ffc51d6db6
commit
d1fe7abb18
|
@ -156,7 +156,7 @@ class AssetsController extends Controller
|
|||
// I am sad. :(
|
||||
switch ($request->input('status')) {
|
||||
case 'Deleted':
|
||||
$assets->withTrashed()->Deleted();
|
||||
$assets->onlyTrashed();
|
||||
break;
|
||||
case 'Pending':
|
||||
$assets->join('status_labels AS status_alias',function ($join) {
|
||||
|
|
|
@ -63,7 +63,7 @@ class UsersController extends Controller
|
|||
|
||||
|
||||
if (($request->filled('deleted')) && ($request->input('deleted')=='true')) {
|
||||
$users = $users->GetDeleted();
|
||||
$users = $users->onlyTrashed();
|
||||
}
|
||||
|
||||
if ($request->filled('company_id')) {
|
||||
|
|
|
@ -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
|
||||
* Get all assets in the provided listing of model ids
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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');
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue