Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call to undefined method App\User::getPendingsCount() #119

Open
bhdrnzl opened this issue Dec 8, 2018 · 2 comments
Open

Call to undefined method App\User::getPendingsCount() #119

bhdrnzl opened this issue Dec 8, 2018 · 2 comments

Comments

@bhdrnzl
Copy link

bhdrnzl commented Dec 8, 2018

controller;
$user = User::find(Auth::id());

blade;
{{ $user->getPendingsCount() }}

error;
Call to undefined method App\User::getPendingsCount()

@TechTailor
Copy link

First of all, use this for getting the currently logged in user. Its much clean.
$user = Auth::user();

Secondly, , the getPendingsCount() function was probably removed as I can't find it in the code and I guess the ReadMe was never updated for it.

You can use a function as this one to get the same results (add the following to vendor\hootlex\laravel-friendships\src\Traits\Friendable.php;

public function getPendingFriendsCount($groupSlug = '')
    {
        $friendsCount = $this->findFriendships(Status::PENDING, $groupSlug)->count();
        return $friendsCount;
    }

However I have not tested it. Will create a PR when I get home after testing.

-TT

@samiklah
Copy link

samiklah commented Sep 5, 2019

check out your User model you are calling an undefined method

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants