multicaret / laravel-acquaintances

This package gives Eloquent models the ability to manage friendships (with groups), followships along with Likes, favorites..etc.
https://laravel-news.com/manage-friendships-likes-and-more-with-the-acquaintances-laravel-package
MIT License
808 stars 72 forks source link

The method popular does not exist on InteractionRelation as documented #23

Closed jwittekind closed 8 months ago

jwittekind commented 3 years ago

Do i miss something here? To me it seems, like a wrong documentation.

mkwsra commented 3 years ago

Perhaps you are checking a different/old version?

Because as you can see it's there: https://github.com/multicaret/laravel-acquaintances/blob/eef71ca743c6a69577bf95cbe0034e47f19f4943/src/Models/InteractionRelation.php#L53

mkwsra commented 3 years ago

I will give it a try later, code-wise, in order to reproduce this issue.

jwittekind commented 3 years ago

Where is the static method that is documented for a Trait ?

$posts = App\Post::popular()->get();
mkwsra commented 3 years ago

Please provide the used traits within your Post model

gowl commented 3 years ago

@jwjuele It seems to me that your question has been answered but please do feel free to elaborate on your issue if it wasn't. Otherwise, you can go ahead and close it,

Just to be sure we're on the same page here, the method you sent is not a static method. It is a local scope, the same one that @mkwsra has mentioned, which goes by scopePopular within the model. What I understood is that you are looking for a function named popular(...) but do correct me if I'm wrong.

jwittekind commented 3 years ago

I'm using an Article model with the trait "canBeFavorited", but I also tried "canBeLiked".

My goal is to query the most popular Articles. As there is a static method called "Post::popular()" documented in the ReadMe, I assumed, that i could use it on my Article Model.

When I received an error, I took a look into the source code and could not find any definition of this documented method.

  1. So, if this method does not exist within these both traits, which traits do include it?

  2. if this the method which should be used Is called "scopePopular", how do I use it, and why isn't it part of the docs?