Fixed Not unique table/alias: 'models' on custom report triggered when category is selected
This commit is contained in:
parent
d8a8e1cc09
commit
51d3d130e4
1 changed files with 2 additions and 2 deletions
|
@ -1180,8 +1180,8 @@ class Asset extends Depreciable
|
||||||
*/
|
*/
|
||||||
public function scopeInCategory($query, $category_id)
|
public function scopeInCategory($query, $category_id)
|
||||||
{
|
{
|
||||||
return $query->join('models', 'assets.model_id', '=', 'models.id')
|
return $query->join('models as category_models', 'assets.model_id', '=', 'category_models.id')
|
||||||
->join('categories', 'models.category_id', '=', 'categories.id')->where('models.category_id', '=', $category_id);
|
->join('categories', 'category_models.category_id', '=', 'categories.id')->where('category_models.category_id', '=', $category_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue