@@ -20,21 +20,29 @@ User Authentication
20
20
Overview
21
21
--------
22
22
23
- In this guide, you can learn how to use the {+odm-long+} to modify the ``User``
24
- model and configure user authentication.
23
+ In this guide, you can learn how to authenticate users stored in MongoDB
24
+ by using Laravel's native authentication functionality.
25
+
26
+ Laravel provides a native Auth module that includes authentication services,
27
+ such as guards that define how users are authenticated and providers that define
28
+ how users are retrieved. To learn more about these services, see `Authentication
29
+ <https://laravel.com/docs/{+laravel-docs-version+}/authentication>`__ in the
30
+ Laravel documentation.
25
31
26
32
User Model
27
33
----------
28
34
29
- By default, Laravel includes an ``App\Models\User`` Eloquent model in your ``app/Models``
30
- directory. You can extend the ``Jenssegers\Mongodb\Auth\User`` class to configure your
31
- ``User`` model to use the Laravel Auth module, which provides multiple authentication services.
35
+ By default, Laravel generates the ``User`` Eloquent model in your ``App/Models``
36
+ directory. To enable authentication for users stored in MongoDB, your ``User`` model
37
+ must extend the ``MongoDB\Laravel\Auth\User`` class.
38
+
32
39
To extend this class, navigate to your ``app/Models/User.php`` file and replace the
33
- ``use Illuminate\Foundation\Auth\User as Authenticatable`` use statement with the following code:
40
+ ``use Illuminate\Foundation\Auth\User as Authenticatable`` use statement with the following
41
+ code:
34
42
35
43
.. code-block:: php
36
44
37
- use Jenssegers\Mongodb \Auth\User as Authenticatable;
45
+ use MongoDB\Laravel \Auth\User as Authenticatable;
38
46
39
47
Ensure that your ``User`` class extends ``Authenticatable``, as shown in the following code:
40
48
@@ -51,7 +59,7 @@ creating a controller, see the :ref:`laravel-auth-controller` section on this pa
51
59
Example
52
60
~~~~~~~
53
61
54
- The following code demonstrates a ``User.php`` file that extends the ``Jenssegers\Mongodb \Auth\User``
62
+ The following code demonstrates a ``User.php`` file that extends the ``MongoDB\Laravel \Auth\User``
55
63
class:
56
64
57
65
.. literalinclude:: /includes/auth/AuthUser.php
0 commit comments