1)Laravel has a very good built in authentication system/module.I had read its documentation the confusion to me is what is definition of a driver in guard and provider?
2)Is defining a new guard means defining a new driver?
1)Laravel has a very good built in authentication system/module.I had read its documentation the confusion to me is what is definition of a driver in guard and provider?
2)Is defining a new guard means defining a new driver?
In the configuration defining a new Guard is defining a coupling of a driver and a provider. In the default setup the Guard web
is the session
driver and the users
provider used together. The driver is the means of actually figuring out the user from a request and the provider is the interface to the records, in simplest terms.
At the class level a Guard is what the configuration refers to as a Driver.
namespace Illuminate\Auth;
class TokenGuard implements Guard
is the token
driver in the api
guard in the config.
namespace Illuminate\Auth;
class SessionGuard implement StatefulGuard, ...
is the session
driver in the web
guard.
'guards' => [
'web' => [
'driver' => 'session',
'provider' => 'users',
],
'api' => [
'driver' => 'token',
'provider' => 'users',
'hash' => false,
],
],