Skip to content

Commit

Permalink
tech review + more info
Browse files Browse the repository at this point in the history
  • Loading branch information
norareidy committed Jul 9, 2024
1 parent a7e7b20 commit f1f0df2
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
2 changes: 2 additions & 0 deletions docs/includes/auth/AuthController.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
Expand Down
2 changes: 1 addition & 1 deletion docs/includes/auth/AuthUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace App\Models;

use Jenssegers\Mongodb\Auth\User as Authenticatable;
use MongoDB\Laravel\Auth\User as Authenticatable;

class User extends Authenticatable
{
Expand Down
24 changes: 16 additions & 8 deletions docs/user-authentication.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,29 @@ User Authentication
Overview
--------

In this guide, you can learn how to use the {+odm-long+} to modify the ``User``
model and configure user authentication.
In this guide, you can learn how to authenticate users stored in MongoDB
by using Laravel's native authentication functionality.

Laravel provides a native Auth module that includes authentication services,
such as guards that define how users are authenticated and providers that define
how users are retrieved. To learn more about these services, see `Authentication
<https://laravel.com/docs/{+laravel-docs-version+}/authentication>`__ in the
Laravel documentation.

User Model
----------

By default, Laravel includes an ``App\Models\User`` Eloquent model in your ``app/Models``
directory. You can extend the ``Jenssegers\Mongodb\Auth\User`` class to configure your
``User`` model to use the Laravel Auth module, which provides multiple authentication services.
By default, Laravel generates the ``User`` Eloquent model in your ``App/Models``
directory. To enable authentication for users stored in MongoDB, your ``User`` model
must extend the ``MongoDB\Laravel\Auth\User`` class.

To extend this class, navigate to your ``app/Models/User.php`` file and replace the
``use Illuminate\Foundation\Auth\User as Authenticatable`` use statement with the following code:
``use Illuminate\Foundation\Auth\User as Authenticatable`` use statement with the following
code:

.. code-block:: php

use Jenssegers\Mongodb\Auth\User as Authenticatable;
use MongoDB\Laravel\Auth\User as Authenticatable;

Ensure that your ``User`` class extends ``Authenticatable``, as shown in the following code:

Expand All @@ -51,7 +59,7 @@ creating a controller, see the :ref:`laravel-auth-controller` section on this pa
Example
~~~~~~~

The following code demonstrates a ``User.php`` file that extends the ``Jenssegers\Mongodb\Auth\User``
The following code demonstrates a ``User.php`` file that extends the ``MongoDB\Laravel\Auth\User``
class:

.. literalinclude:: /includes/auth/AuthUser.php
Expand Down

0 comments on commit f1f0df2

Please sign in to comment.