So that you can log in through Laravel to your database - you need to create your own driver for authorization in which to override the method that checks passwords or create your own hasher, I will tell you by the first option.
The stages are not small, so I'll show you right away with an example:
1) First you need to create your own Provider, which is inherited from EloquentUserProvider and override the validateCredentials method in it:
namespace App\Extensions; use Illuminate\Support\Str; use Illuminate\Auth\EloquentUserProvider; class CustomUserProvider extends EloquentUserProvider { /** * Validate a user against the given credentials. * * @param \Illuminate\Contracts\Auth\Authenticatable $user * @param array $credentials * @return bool */ public function validateCredentials(UserContract $user, array $credentials) { $plain = $credentials['password']; return $this->hasher->check($plain, $user->getAuthPassword()); } }
This is the original method, change the logic of checking for your own in it, the main thing is that the output will have a bool value. The variable $plain is the password that the user entered on the login form.
2) Now let us say that the framework will work with users through our new provider. To do this, change a couple of lines in config/auth.php :
'users' => [ 'driver' => 'custom', 'model' => App\Entities\User::class //Обратите внимание на путь к модели, у меня он не стандартный ],
3) But before you check, you must declare the provider. To do this, we specify the AuthServiceProvider in the boot method in the AuthServiceProvider method:
\Auth::provider('custom', function ($app, array $config) { return new CustomUserProvider($app['hash'], $config['model']); });
4) Now you can check the authorization, it will work through the new provider.
PS There are some problems with formatting the code in the answer, but it seems to work.
DECODE... - Ep1demic