I am not very sure and the following is a wild try only
$result = BookMarkModel::whereIn('tag_id', function($q)
{
$q->DB::raw('select id from tags where name in ('new', 'please','work')')
})
->whereIn('bookmark_id', function($query)
{
$query->DB::raw('select id from bookmarks where userid = 1')
})
->get();
Something like this:
$taggedBookmarks = Auth::user()->bookmarks()->with( [ 'tags' => function($query) use ($tags) {
$query->whereIn('name', $tags);
} ] )->get() ;
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community