M
M
Maks Burkov2018-02-17 04:26:04
Laravel
Maks Burkov, 2018-02-17 04:26:04

What are providers?

When deepening in Laravel, I stumble upon Providers everywhere, according to the logic, a provider is a service provider, which means that any piece of code can be called a provider that provides services ..
I got confused in the terminology.
Drivers vs Providers. Who cares ?
Provider is specified -> users I can't find this provider where should it be located ?
Where are Laravel's auth.php settings read from?
The auth.php section is kinda magical for me as a Laravel newbie.. Need some help from those who understand!
From Laravel: auth.php

'guards' => [
        'web' => [
            'driver' => 'session',
            'provider' => 'users',
        ],

        'api' => [
            'driver' => 'token',
            'provider' => 'users',
        ],
    ],
    'providers' => [
        'users' => [
            'driver' => 'eloquent',
            'model' => App\User::class,
        ],

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
JhaoDa, 2018-02-17
@Maks00088

Where are Laravel's auth.php settings read from?
Nowhere, because auth.phpthis is the settings.
Provider is specified -> users I can't find this provider where should it be located ?
What exactly can't you do? Lower your eyes a few times lower and see
'users' => [
    'driver' => 'eloquent',
    'model' => App\User::class,
],
you can not?
Upd: TC explained that "where it should be" means the physical location of the file. It’s not very clear, however, why at the stage of studying the frame to know such subtleties, but here: look here , then here .
And rightly so, a provider is a class that provides something. In this case, users.
And, for example, service providers provide the configured classes needed for the application to work.
Tell me honestly - have you tried reading the documentation?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question