Keep only specific id Laravel
I have a table Foo
id
1
2
3
4
5
i have a table Bar
foo_id = 1 test = 1
foo_id = 2 test = 0
foo_id = 4 test = 1
foo_id = 5 test = 1
I want to retrieve id from foo where bar test = 0 or not exist in bar.
I have
$id = Foo::with('bar')->whereHas('bar', function ($q)
{$q->where('test', '=', 0)
->orWhereNull(foo_id???????);})
->get();
How can i write this down?
from Laravel Questions and Answers https://laravelquestions.com/laravel/keep-only-specific-id-laravel/
via Lzo Media
No comments:
Post a Comment