Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

osherdo's avatar

Steps after defining relationship

I have 3 tables: user,posts and followee_posts.

I have set a model called 'followee' that should relate followee to a user.

Also have pivot table that contains 'follower_id' and 'followee_id'.

I have also set a model called 'Followee.php'

I have set the many-to-many relatioship inside it.

Now what else I need to do so a user can press a button and the user selected will be added to the followee pivot table?

I am reading the docs and stuck right after the relationship is defined. what's next? I already have set the model that points out that basically says: many users can follow many users. Here's the model code (Followee.php): http://paste.ofcode.org/qSqaxRMttXxYDeVTPxfLkK

So now I need to let the user to add other users to the followee pivot table.

0 likes
3 replies
jlrdw's avatar

Did you see the two tutorials in the docs that is a good starting point.

Please or to participate in this conversation.