master

laravel/framework

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

GateEvaluated.php

TLDR

This file contains the definition of the GateEvaluated class, which is an event class used in the Laravel framework's authentication and authorization system.

Classes

GateEvaluated

This class represents an event that is fired after the evaluation of a gate. It has the following properties:

  • $user: An instance of Illuminate\Contracts\Auth\Authenticatable representing the authenticated user.
  • $ability: A string representing the ability being evaluated.
  • $result: A boolean value representing the result of the evaluation.
  • $arguments: An array containing the arguments given during the evaluation.

This class has a constructor method that accepts the above properties as parameters and initializes the corresponding class properties.

<?php

namespace Illuminate\Auth\Access\Events;

class GateEvaluated
{
    /**
     * The authenticatable model.
     *
     * @var \Illuminate\Contracts\Auth\Authenticatable|null
     */
    public $user;

    /**
     * The ability being evaluated.
     *
     * @var string
     */
    public $ability;

    /**
     * The result of the evaluation.
     *
     * @var bool|null
     */
    public $result;

    /**
     * The arguments given during evaluation.
     *
     * @var array
     */
    public $arguments;

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