I've followed this tutorial to create a custom hash and I've implemented Multi-Auth system in Laravel 5.3 too (works fine) but I want to know:
Can I use multiple DB hashes between these authentications?
Is that possible?
Before you ask: Yes, that's necessary for my project!
If you already have a working multi auth system and an extra hasher that uses md5, you can inject it in your custom auth provider. Here are possible steps you might require.
If you only want another hasher you may try using core provider:
Create a My\\Library\\MyHasher
implementing core contract https://github.com/illuminate/contracts/blob/master/Hashing/Hasher.php (as in the tutorial)
Register / inject it in the AuthServiceProvider boot method under your app's providers, something like that:
// instantiate or inject the new hasher as $hasher
Auth::provider('md5user', function($app, array $config) use ($hasher) { return new \\Illuminate\\Auth\\EloquentUserProvider\\EloquentUserProvider($hasher, $config['model']); });
If you want to be able to tweak the provider functionality:
Create a My\\Library\\MyUserProvider
similar to a core one https://github.com/illuminate/auth/blob/master/EloquentUserProvider.php and change what you need
Create a My\\Library\\MyHasher
implementing core contract https://github.com/illuminate/contracts/blob/master/Hashing/Hasher.php
Register / inject them in the AuthServiceProvider boot method under your app's providers:
// instantiate or inject the new hasher as $hasher
Auth::provider('md5user', function($app, array $config) use ($hasher) { return new \\My\\Library\\MyUserProvider($hasher, $config['model']); });
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.