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

This can be done. But you need another model to keep the relationship. see this post http://laravel.io/forum/03-04-2014-hasmanythrough-with-many-to...

0

How about follows table that will create a record when one user starts following another user. Table structure can be like this:

follows: id | follower_id | followed_id | ...

Then you can search for all followers of a certain user this way:

select * from follows where followed_id = x

Now this may not be the best practice depending on your app, but just one way to do it.

Last updated 8 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

osherdo osherdo Joined 26 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.