This query requires an additional trait. Please add the Staudenmeir\EloquentHasManyDeep\HasTableAlias trait to App\Models\YourModel.
Queries with has()/whereHas()/withCount()/loadCount() require a temporary table alias to work when the parent table also appears as an intermediate table. The package can set this alias, but it requires an additional trait in the affected model.
Please add the HasTableAlias trait to the parent model that is shown in the exception message:
class YourModel extends Model
{
use \Staudenmeir\EloquentHasManyDeep\HasTableAlias;
}
Queries with
has()
/whereHas()
/withCount()
/loadCount()
require a temporary table alias to work when the parent table also appears as an intermediate table. The package can set this alias, but it requires an additional trait in the affected model.Please add the
HasTableAlias
trait to the parent model that is shown in the exception message:Then run the query again.