Support the ongoing development of Laravel.io →
Database Eloquent
Last updated 1 year ago.
0

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();
Last updated 9 years ago.
0

Something like this:

$taggedBookmarks = Auth::user()->bookmarks()->with( [ 'tags' => function($query) use ($tags) {
    $query->whereIn('name', $tags);
} ] )->get() ;
0

Sign in to participate in this thread!

Eventy

Your banner here too?

stirredo stirredo Joined 19 Apr 2015

Moderators

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

Your logo here?

Laravel.io

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

© 2024 Laravel.io - All rights reserved.