Answer the question
In order to leave comments, you need to log in
Why is notIn not working on a given selection in Laravel?
Tags::where('name', 'LIKE', '%' . $like . '%')
->whereNotIn('id', $deprecate)
->where(function ($q) use ($id) {
$q->whereHas('closure', function ($q) use ($id) {
$q->where('tags_closure.ancestor_id', '=', $id);
})->orWhere(function ($q) {
$q->where('is_sealed', 1);
});
})
->with('closure')
->get();
Answer the question
In order to leave comments, you need to log in
What is the output request?
maybe the problem will become clear there,
let's try this
$q = Tags::where('name', 'LIKE', '%' . $like . '%')
->whereNotIn('id', $deprecate)
->where(function ($q) use ($id) {
$q->whereHas('closure', function ($q) use ($id) {
$q->where('tags_closure.ancestor_id', '=', $id);
})->orWhere(function ($q) {
$q->where('is_sealed', 1);
});
})
->with('closure');
$sql = $q->toSql();
var_dump($sql);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question