laravel-acquaintances icon indicating copy to clipboard operation
laravel-acquaintances copied to clipboard

The method popular does not exist on InteractionRelation as documented

Open jwittekind opened this issue 4 years ago • 6 comments

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

jwittekind avatar Dec 28 '20 20:12 jwittekind

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 avatar Dec 29 '20 14:12 mkwsra

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

mkwsra avatar Dec 29 '20 14:12 mkwsra

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

$posts = App\Post::popular()->get();

jwittekind avatar Dec 31 '20 08:12 jwittekind

Please provide the used traits within your Post model

mkwsra avatar Jan 01 '21 10:01 mkwsra

@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.

gowl avatar Jan 11 '21 09:01 gowl

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?

jwittekind avatar Jan 11 '21 10:01 jwittekind