Support the ongoing development of →
Authentication Eloquent Installation
Last updated 1 month ago.

Laravel has some built in classes for validation: and the validation functionality is pretty complete. then there are "FormRequests", which actually get executed before any code in your controller actions.

but you can use validators most anywhere you want to instantiate them. validating on your controller could be a good way to catch errors before anything else happens, and controllers implement a trait called "validates requests" which make it easy to define velidation rules right there on the controller.


Hi Igalaz, and first of all thank you for your answer.

I think that the function name of the code I've posted can lead to misunderstandings.

Even if its name is "validateCredentials", it isn't called upon form validation phase, but after it, in order to log a user in.

After the login form validation (and only if result is ok), the "user login" function is called.

My problem is that with my legacy "Users" table, it is impossible to log in any user to the application due to the password check method.

So I'll try to rephrase the question: is there any standard way to modify the default password check of the Eloquent User Provider?


why not use Hash::check()

if (Hash::check('plain-text', $hashedPassword)) {
    // The passwords match...
Last updated 5 years ago.

Also you might wanna see this thread, read barryvdh's reply

Last updated 5 years ago.

Thank you astronau. Your last link drove me to the solution.

I had to implement a custom authentication provider. At the end I managed to do it, following the documentation that I've found to add custom authentication providers.

I think that can be useful to improve this documentation, because I was trying to implement this extension using the method described here, which hasn't been updated for version 5.2:

Auth::extend('riak', function($app)
    // Return implementation of Illuminate\Contracts\Auth\UserProvider

I had to use the "provider" function instead:

$this->app['auth']->provider('dbe', function($app, array $config) {
    // Return an instance of Illuminate\Contracts\Auth\UserProvider...
    return new DbeUserProvider($this->app['hash'], $config['model']);

Anyway now the extension is working, so thank you all for your help!

Last updated 5 years ago.

Sign in to participate in this thread!


Your banner here too?

mafabio mafabio mafabio Joined 12 Aug 2016


We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2022 - All rights reserved.