Class App\Repositories\UserRepository does not exist
12,985
Solution 1
Probably a namespace issue
Check the path of your UserRepository
file class. It should be:
app/Repositories/UserRepository.php
And inside the class file you need to use this namespace:
namespace App/Repositories;
This should work
Solution 2
you would want to do composer dump-autoload
and it will fix your issue
given that you have all your namespaces / class names correctly
Author by
Neethu
Updated on June 04, 2022Comments
-
Neethu almost 2 years
<?php namespace App\Http\Controllers; use Illuminate\Contracts\Auth\Guard; use Laravel\Socialite\Contracts\Factory as Socialite; use App\Repositories\UserRepository; class SocialController extends Controller { /** * Redirect the user to the GitHub authentication page. * * @return Response */ private $socialite; private $auth; private $users; public function __construct(Socialite $socialite, Guard $auth, UserRepository $users) { $this->socialite = $socialite; $this->users = $users; $this->auth = $auth; } }
This is my controller. While I'm loading this controller it showing an error like
"ReflectionException in Container.php line 791: Class App\Repositories\UserRepository does not exist".
Can anyone suggest me a solution?
-
Kamran Syed almost 5 yearsIt gives me error that (dot) cannot be used in use. Any ideas?
-
Tyler2P over 2 yearsCould you provide a code example with this explanation?