{"repo":"renoki-co/befriended","free":true,"listed":false,"github":"https://github.com/renoki-co/befriended","clone":"git clone https://github.com/renoki-co/befriended.git","description":"Eloquent Befriended brings social media-like features like following, blocking and filtering content based on following or blocked models.","language":"PHP","stars":761,"topics":["laravel","social","media","eloquent","model","follow","following","block","blocking","blocker"],"license":"Apache-2.0","category":"api-integrations-sdks","readme_excerpt":"Laravel Befriended ================== Eloquent Befriended brings social media-like features like following, blocking and filtering content based on following or blocked models 🤝 Supporting If you are using one or more Renoki Co. open-source packages in your production apps, in presentation demos, hobby projects, school projects or so, sponsor our work with Github Sponsors. 📦 🚀 Installation Install the package: Publish the config: Publish the migrations: 🙌 Usage The power of example is better here. This package allows you simply to assign followers, blockings or likes without too much effort. What makes the package powerful is that you can filter queries using scopes out-of-the-box. Following To follow other models, your model should use the CanFollow trait and Follower contract. The other models that can be followed should use CanBeFollowed trait and Followable contract. If your model can both follow & be followed, you can use Follow trait and Following contract. Let's suppose we have an User model which can follow and be followed. Within it, we can now check for followers or follow new users: Now, let's suppose we have a Page model, than can only be followed: By default, if querying following() and followers() from the User instance, the relationships will return only User instances. If you plan to retrieve other instances, such as Page , you can pass the model name or model class as an argument to the relationships: On-demand, you can check if your model follows some ot","default_branch":null,"files":null,"tree":[],"storefront":"/r/renoki-co","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/renoki-co/befriended/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}