Fixes constraint violation when ordering some columns

This commit is contained in:
Ivan Nieto Vivanco 2022-05-24 14:00:23 -05:00
parent 0a6626891e
commit e0b64a4879

View file

@ -1187,7 +1187,9 @@ class Asset extends Depreciable
public function scopeRequestableAssets($query)
{
return Company::scopeCompanyables($query->where('requestable', '=', 1))
$table = $query->getModel()->getTable();
return Company::scopeCompanyables($query->where($table.'.requestable', '=', 1))
->whereHas('assetstatus', function ($query) {
$query->where(function ($query) {
$query->where('deployable', '=', 1)