master

laravel/framework

Last updated at: 29/12/2023 09:20

Login.php

TLDR

The Login.php file in the Illuminate\Auth\Events namespace defines a Login event class. This class represents an event that is triggered when a user logs in. It contains properties to store the authentication guard name, the authenticated user, and whether the user should be remembered.

Class

Login

The Login class represents an event that is triggered when a user logs in. It has the following properties:

  • $guard: The authentication guard name.
  • $user: The authenticated user.
  • $remember: Indicates if the user should be "remembered".

The Login class has a constructor that accepts the authentication guard name, the authenticated user, and a boolean value indicating whether the user should be remembered. It initializes the class properties with the provided values.

Example:

use Illuminate\Auth\Events\Login;

// Create a new Login event instance
$event = new Login('web', $user, true);
<?php

namespace Illuminate\Auth\Events;

use Illuminate\Queue\SerializesModels;

class Login
{
    use SerializesModels;

    /**
     * The authentication guard name.
     *
     * @var string
     */
    public $guard;

    /**
     * The authenticated user.
     *
     * @var \Illuminate\Contracts\Auth\Authenticatable
     */
    public $user;

    /**
     * Indicates if the user should be "remembered".
     *
     * @var bool
     */
    public $remember;

    /**
     * Create a new event instance.
     *
     * @param  string  $guard
     * @param  \Illuminate\Contracts\Auth\Authenticatable  $user
     * @param  bool  $remember
     * @return void
     */
    public function __construct($guard, $user, $remember)
    {
        $this->user = $user;
        $this->guard = $guard;
        $this->remember = $remember;
    }
}