title: Why I obtain this "Class App\Listeners\LogAuthenticationAttempt does not exist" error trying to log in using a custom user provider?
body: <p>I am pretty new in <strong>PHP</strong> and <strong>Laravel</strong> framework and I am going crazy trying to implement the following task.</p>
  
  <p>I am trying to follow this tutorial to implement a <strong>custom user provider</strong>:</p>
  
  <p><a href="https://blog.georgebuckingham.com/laravel-52-auth-custom-user-providers-drivers/" rel="nofollow noreferrer">https://blog.georgebuckingham.com/laravel-52-auth-custom-user-providers-drivers/</a></p>
  
  <p>I am using <strong>Larave 5.3</strong> version.</p>
  
  <p>I briefly expain what I need: my <strong>Laravel</strong> application is only a <strong>front end</strong> application, all the business logic, included the user authentication, is performed by a <strong>Java back end application</strong> that exposes <strong>REST</strong> web services.</p>
  
  <p>Performing a call to:</p>
  
  <pre><code>http://localhost:8080/Extranet/login
  </code></pre>
  
  <p>and passing username and password as <strong>basic authentication</strong> I obtain a <strong>JSON</strong> response like this that represent the logged user:</p>
  
  <pre><code>{
    "userName": "Painkiller",
    "email": "painkiller@gmail.com",
    "enabled": true
  }
  </code></pre>
  
  <p>So, in my Laravel application, I have to perform this call and then parse the previous returned JSON object to generate the authenticated object into the front end application session.</p>
  
  <p>I think that the previous <strong>custom user provide</strong>r is the neater and most natural solution to do it, but I am obtaining an erro, I will explain the situation.</p>
  
  <p>I have implemented all the <strong>4 steps</strong> of the previous tutorial and I think that I have correctly replaced the user provider with my <strong>custom user provider</strong>.</p>
  
  <p>Aftere these implementation steps I performed this command:</p>
  
  <pre><code>php artisan make:auth
  </code></pre>
  
  <p>to generate te <strong>view</strong> and the <strong>routes</strong> related to the Laravel <strong>login</strong> system. I expect that it is using the <strong>custom user provider</strong> defined by me.</p>
  
  <p>So I have these routes:</p>
  
  <pre><code>$ php artisan route:list
  +--------+----------+------------------------+----------+------------------------------------------------------------------------+--------------+
  | Domain | Method   | URI                    | Name     | Action                                                                 | Middleware   |
  +--------+----------+------------------------+----------+------------------------------------------------------------------------+--------------+
  |        | GET|HEAD | /                      |          | App\Http\Controllers\LoginBetriviusController@index                    | web          |
  |        | GET|HEAD | api/user               |          | Closure                                                                | api,auth:api |
  |        | POST     | doLogin                |          | App\Http\Controllers\LoginBetriviusController@doLogin                  | web          |
  |        | GET|HEAD | home                   |          | App\Http\Controllers\HomeController@index                              | web,auth     |
  |        | POST     | login                  |          | App\Http\Controllers\Auth\LoginController@login                        | web,guest    |
  |        | GET|HEAD | login                  | login    | App\Http\Controllers\Auth\LoginController@showLoginForm                | web,guest    |
  |        | POST     | logout                 | logout   | App\Http\Controllers\Auth\LoginController@logout                       | web          |
  |        | POST     | password/email         |          | App\Http\Controllers\Auth\ForgotPasswordController@sendResetLinkEmail  | web,guest    |
  |        | GET|HEAD | password/reset         |          | App\Http\Controllers\Auth\ForgotPasswordController@showLinkRequestForm | web,guest    |
  |        | POST     | password/reset         |          | App\Http\Controllers\Auth\ResetPasswordController@reset                | web,guest    |
  |        | GET|HEAD | password/reset/{token} |          | App\Http\Controllers\Auth\ResetPasswordController@showResetForm        | web,guest    |
  |        | GET|HEAD | register               | register | App\Http\Controllers\Auth\RegisterController@showRegistrationForm      | web,guest    |
  |        | POST     | register               |          | App\Http\Controllers\Auth\RegisterController@register                  | web,guest    |
  +--------+----------+------------------------+----------+------------------------------------------------------------------------+--------------+
  </code></pre>
  
  <p>As you can see there are the standard login routes. I think that now it have to use my <strong>custom user provider</strong> (the one that call my REST web service) instead the standard one.</p>
  
  <p>I run the application using the statment:</p>
  
  <pre><code>php artisan serve
  </code></pre>
  
  <p>It starts without no error, then I access to this URL:</p>
  
  <pre><code>http://localhost:8000/login
  </code></pre>
  
  <p>and the login page is correctly displayed.</p>
  
  <p>Then i insert the credential (e-mail and password) but when I submit the login form I obtain this error message:</p>
  
  <pre><code>ReflectionException in Container.php line 749:
  Class App\Listeners\LogAuthenticationAttempt does not exist
  in Container.php line 749
  at ReflectionClass-&gt;__construct('App\Listeners\LogAuthenticationAttempt') in Container.php line 749
  at Container-&gt;build('App\Listeners\LogAuthenticationAttempt', array()) in Container.php line 644
  at Container-&gt;make('App\Listeners\LogAuthenticationAttempt', array()) in Application.php line 709
  at Application-&gt;make('App\Listeners\LogAuthenticationAttempt') in Dispatcher.php line 373
  at Dispatcher-&gt;createClassCallable('App\Listeners\LogAuthenticationAttempt', object(Application)) in Dispatcher.php line 354
  at Dispatcher-&gt;Illuminate\Events\{closure}(object(Attempting))
  at call_user_func_array(object(Closure), array(object(Attempting))) in Dispatcher.php line 221
  at Dispatcher-&gt;fire(object(Attempting)) in SessionGuard.php line 401
  at SessionGuard-&gt;fireAttemptEvent(array('email' =&gt; 'dsfsdf@sdfsdf.com', 'password' =&gt; 'fdsfsdfsdf'), true, true) in SessionGuard.php line 351
  at SessionGuard-&gt;attempt(array('email' =&gt; 'dsfsdf@sdfsdf.com', 'password' =&gt; 'fdsfsdfsdf'), true) in AuthenticatesUsers.php line 77
  at LoginController-&gt;attemptLogin(object(Request)) in AuthenticatesUsers.php line 42
  at LoginController-&gt;login(object(Request))
  at call_user_func_array(array(object(LoginController), 'login'), array(object(Request))) in Controller.php line 55
  at Controller-&gt;callAction('login', array(object(Request))) in ControllerDispatcher.php line 44
  at ControllerDispatcher-&gt;dispatch(object(Route), object(LoginController), 'login') in Route.php line 190
  at Route-&gt;runController() in Route.php line 144
  at Route-&gt;run(object(Request)) in Router.php line 653
  at Router-&gt;Illuminate\Routing\{closure}(object(Request)) in Pipeline.php line 53
  at Pipeline-&gt;Illuminate\Routing\{closure}(object(Request)) in RedirectIfAuthenticated.php line 24
  at RedirectIfAuthenticated-&gt;handle(object(Request), object(Closure)) in Pipeline.php line 137
  at Pipeline-&gt;Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 33
  at Pipeline-&gt;Illuminate\Routing\{closure}(object(Request)) in SubstituteBindings.php line 41
  at SubstituteBindings-&gt;handle(object(Request), object(Closure)) in Pipeline.php line 137
  at Pipeline-&gt;Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 33
  at Pipeline-&gt;Illuminate\Routing\{closure}(object(Request)) in VerifyCsrfToken.php line 65
  at VerifyCsrfToken-&gt;handle(object(Request), object(Closure)) in Pipeline.php line 137
  at Pipeline-&gt;Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 33
  at Pipeline-&gt;Illuminate\Routing\{closure}(object(Request)) in ShareErrorsFromSession.php line 49
  at ShareErrorsFromSession-&gt;handle(object(Request), object(Closure)) in Pipeline.php line 137
  at Pipeline-&gt;Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 33
  at Pipeline-&gt;Illuminate\Routing\{closure}(object(Request)) in StartSession.php line 64
  at StartSession-&gt;handle(object(Request), object(Closure)) in Pipeline.php line 137
  at Pipeline-&gt;Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 33
  at Pipeline-&gt;Illuminate\Routing\{closure}(object(Request)) in AddQueuedCookiesToResponse.php line 37
  at AddQueuedCookiesToResponse-&gt;handle(object(Request), object(Closure)) in Pipeline.php line 137
  at Pipeline-&gt;Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 33
  at Pipeline-&gt;Illuminate\Routing\{closure}(object(Request)) in EncryptCookies.php line 59
  at EncryptCookies-&gt;handle(object(Request), object(Closure)) in Pipeline.php line 137
  at Pipeline-&gt;Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 33
  at Pipeline-&gt;Illuminate\Routing\{closure}(object(Request)) in Pipeline.php line 104
  at Pipeline-&gt;then(object(Closure)) in Router.php line 655
  at Router-&gt;runRouteWithinStack(object(Route), object(Request)) in Router.php line 629
  at Router-&gt;dispatchToRoute(object(Request)) in Router.php line 607
  at Router-&gt;dispatch(object(Request)) in Kernel.php line 268
  at Kernel-&gt;Illuminate\Foundation\Http\{closure}(object(Request)) in Pipeline.php line 53
  at Pipeline-&gt;Illuminate\Routing\{closure}(object(Request)) in CheckForMaintenanceMode.php line 46
  at CheckForMaintenanceMode-&gt;handle(object(Request), object(Closure)) in Pipeline.php line 137
  at Pipeline-&gt;Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 33
  at Pipeline-&gt;Illuminate\Routing\{closure}(object(Request)) in Pipeline.php line 104
  at Pipeline-&gt;then(object(Closure)) in Kernel.php line 150
  at Kernel-&gt;sendRequestThroughRouter(object(Request)) in Kernel.php line 117
  at Kernel-&gt;handle(object(Request)) in index.php line 54
  at require_once('C:\Users\Andrea\Documents\Betrivius\WorkSpace\betriviusExtranet\public\index.php') in server.php line 21
  </code></pre>
  
  <p>Why? What could be wrong? How can I try to ix this issue?</p>
  
  <p>I am not into Laravel but searching online information about Laravel login and the problem to the missing <strong>LogAuthenticationAttempt</strong> class I have fount this SO post: </p>
  
  <p><a href="https://stackoverflow.com/questions/37813677/log-failed-login-attempts-with-laravel-5-2">Log failed login attempts with Laravel 5.2</a></p>
  
  <p>Maybe it is a similar problem but I am not understanding it it could be the same situation and how to solve it.</p>
  
  <p>What can I do?</p>