master

laravel/framework

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

ConnectionEvent.php

TLDR

This file contains the ConnectionEvent class, which is an abstract class representing a connection event in the Illuminate\Database\Events namespace.

Classes

ConnectionEvent

The ConnectionEvent class is an abstract class representing a connection event. It has the following properties:

  • $connectionName: The name of the connection.
  • $connection: The database connection instance.

The class also has a constructor method that takes a $connection parameter and initializes the $connection and $connectionName properties.

<?php

namespace Illuminate\Database\Events;

abstract class ConnectionEvent
{
    /**
     * The name of the connection.
     *
     * @var string
     */
    public $connectionName;

    /**
     * The database connection instance.
     *
     * @var \Illuminate\Database\Connection
     */
    public $connection;

    /**
     * Create a new event instance.
     *
     * @param  \Illuminate\Database\Connection  $connection
     * @return void
     */
    public function __construct($connection)
    {
        $this->connection = $connection;
        $this->connectionName = $connection->getName();
    }
}