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\Repositories\BaseRepository::create() #1284

Closed
happytodev opened this issue Oct 13, 2019 · 6 comments
Closed

Call to undefined method App\Repositories\BaseRepository::create() #1284

happytodev opened this issue Oct 13, 2019 · 6 comments

Comments

@happytodev
Copy link

Hello,

I've searched in closed issues and found nothing to solve this.
After a fresh install and define in .env facebook app credentials, when I will register via facebook I have this error :

Symfony\Component\Debug\Exception\FatalThrowableError
Call to undefined method App\Repositories\BaseRepository::create()

App\Repositories\Frontend\Auth\UserRepository::findOrCreateProvider
:269
C:\laragon\www\wishlist2020\app\Repositories\Frontend\Auth\UserRepository.php:269

`/*

     * If the user does not exist create them

     * The true flag indicate that it is a social account

     * Which triggers the script to use some default values in the create method

     */

    if (! $user) {

        // Registration is not enabled

        if (! config('access.registration')) {

            throw new GeneralException(__('exceptions.frontend.auth.registration_disabled'));

        }



        // Get users first name and last name from their full name

        $nameParts = $this->getNameParts($data->getName());



        $user = parent::create([

            'first_name' => $nameParts['first_name'],

            'last_name' => $nameParts['last_name'],

            'email' => $user_email,

            'active' => true,

            'confirmed' => true,

            'password' => null,

            'avatar_type' => $provider,

        ]);`

This is the parent::create call who trigger this error.

Laravel boilerplate v6.0

If needed I can provide more details.
Thanks

@happytodev
Copy link
Author

Little precision : In the previous version of laravel boilerplate I do not have this error

@happytodev
Copy link
Author

After quick analyse of previous version (v5.3.8), it appears that create function exists in RepositoryContract.php and in baseRepository.php.

Probably the problems occurs here. No ?

@happytodev
Copy link
Author

Based on the code of version 5.3.8, I added the create function in the BaseRepository.php file and in the RepositoryContract.php file and it works again without problems.

@hexpit
Copy link

hexpit commented Oct 22, 2019

I am learning laravel and facing same issue. please help me resolving this.

@rappasoft
Copy link
Owner

Try changing

parent::create
to

$this->model::create

@hexpit
Copy link

hexpit commented Oct 22, 2019 via email

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