Support the ongoing development of →
Database Eloquent
Last updated 2 years ago.

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')
Last updated 9 years ago.

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!


Your banner here too?

stirredo stirredo Joined 19 Apr 2015


We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 - All rights reserved.