Laravel API JSON customization and table relationship
问题 I'm developing a social media project using Laravel. I need to provide a customized API for Follows and Followers. Accordingly, I want to establish a relationship between the user table and the followers and followed tables. I have looked at a lot of resources but get confused. Can anyone help me with relationships? Models Users: id, username, email, password Follows: id, user_id, follow_id(user_id) Followers: id, user_id, follower_id(user_id) API Url: http://localhost/api/follows/user_id/1