0

I created a new class under /app/UserRepositories/UserRepository.php.
Now i want to use it in my AuthenticateUser.php under /app.
I tried to import it like that use App\Repositories\UserRepository;
but I get still the same error: Class does not exist

UserRepository.php

<?php use App\Repositories;

use App\User;

class UserRepository {

    public function updateOrCreate($userData)
     {
        return User::firstOrCreate([
            'username' => $userData->username,
            'email'    => $userData->email,
            'avatar'   => $userData->avatar

        ]);
     }

}

1 Answer 1

1

At the beginning of your file /app/UserRepositories/UserRepository.php, you will need to namespace it using:

namespace App\UserRepositories;

Then you can import it to be used anywhere by:

use App\UserRepositories\UserRepository;
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.