Sky Blue Sofa Blog New Laravel Followers Repository - Sky Blue Sofa Blog

New Laravel Followers Repository

Posted by Dave Rogers // September 8, 2016 // in Blog // 0 Comments

Ducks-Following-a-Duck.jpg

The history behind this new package for Laravel is twofold:

  1. I've been looking for a reason to contribute to the open source community
  2. I was trying to find a package that would do what I needed, but couldn't find it

So I created Laravel Followers. This package allows for moderated, non-reciprocal following between Eloquent models.

Great! What's that mean?

  • With two traits, CanFollow and CanBeFollowed, that can be applied to your models, you can allow a 'following' relationship between models.
  • A third trait, Followable, encapsulates the first two traits for ease of use.
  • When a User, for example, seeks to follow another User, a pending Follower relationship is created.
  • The followed User can then Approve or Deny the follow. This is the 'moderated' part.
  • If the followed User approves the relationship, they do not automatically follow the first User. This is the 'non-reciprocal' part.
  • Users can also block another User from being able to follow them.
  • It's not just Users that can follow and be followed. These traits can be added to any Eloquent model!

The Laravel Followers repository can be found on GitHub at https://github.com/skybluesofa/laravel-followers.

Let me know what projects you use it in. Or, if you have any issues or suggestions, let me know over on GitHub.

I'd like to give a shoutout to Alyx Kyriakidis, aka hootlex on GitHub. It was his project, Laravel Friendships, that provided a starting point for my first real open-source project.

About the Author

Dave Rogers

Dave is the founder of Sky Blue Sofa Web Design. He enjoys working out, spending time with his wife and dogs and programming. He grew up and currently resides in the Illinois Quad Cities. You can find his personal blog at strength/reliance.com.

View Profile »

Comments

You must be logged in to leave a reply. Login »