Closed jonjieviduya closed 4 months ago
I'm trying to add where condition inside the query() method, but it is not working as expected. Please see my code below.
where
query()
Basically, the ->where('parent_id', 0) is the one that I want to add, however, for some reason, it still returns all the data.
->where('parent_id', 0)
public function query(ProductCategory $model) { return $model->newQuery() ->select(['id', 'parent_id', 'name', 'slug', 'enabled']) ->where('parent_id', 0) ->orderBy('id', 'desc'); }
I'm trying to add
where
condition inside thequery()
method, but it is not working as expected. Please see my code below.Basically, the
->where('parent_id', 0)
is the one that I want to add, however, for some reason, it still returns all the data.