You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have relations with parent_id on table categories: categories
id - integer categories
id - integer
parent_id - integer products
id - integer
category_id - integer
Model
class Category extends Model {
publicfunctionproducts()
{
return$this->hasMany('App\Product');
}
publicfunctionsub_products()
{
return$this->hasManyThrough('App\Product','App\Category','parent_id','category_id','id','id');
}
}
Description:
Wrong withCount with hasManyThrough() relations
Steps To Reproduce:
Relations
I have relations with parent_id on table categories:
categories
id - integer
categories
id - integer
parent_id - integer
products
id - integer
category_id - integer
Model
Problem
I make request:
Request return sub_products items, but count return always 0! Thanks!
The text was updated successfully, but these errors were encountered: