Support the ongoing development of Laravel.io →
posted 8 years ago
Eloquent
Last updated 2 years ago.

ashanoulu liked this thread

1
Solution

You could try a whereDoesntHave


$notRead = News::whereDoesntHave('readUsers', function ($q) { 
        $q->where('user_id', Auth::id()); 
    })->orderBy('date', 'ASC')->paginate(20);


ashanoulu liked this reply

1

Thanks @lagbox that's works!

ashanoulu liked this reply

1

Sign in to participate in this thread!

Eventy

Your banner here too?

t-vieira t-vieira Joined 9 Oct 2014

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.