master

laravel/framework

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

MigrationEvent.php

TLDR

This file MigrationEvent.php is part of the Illuminate\Database\Events namespace and provides an abstract class MigrationEvent that implements the MigrationEvent contract. It defines properties for a migration instance and the migration method that was called. The class also includes a constructor to initialize these properties.

Classes

MigrationEvent

This abstract class represents a migration event and implements the MigrationEvent contract. It provides the following properties:

  • $migration: A migration instance of type \Illuminate\Database\Migrations\Migration.
  • $method: A string representing the migration method that was called.

The class includes a constructor:

public function __construct(Migration $migration, $method)

This constructor initializes the $migration and $method properties with the values passed as arguments.

<?php

namespace Illuminate\Database\Events;

use Illuminate\Contracts\Database\Events\MigrationEvent as MigrationEventContract;
use Illuminate\Database\Migrations\Migration;

abstract class MigrationEvent implements MigrationEventContract
{
    /**
     * A migration instance.
     *
     * @var \Illuminate\Database\Migrations\Migration
     */
    public $migration;

    /**
     * The migration method that was called.
     *
     * @var string
     */
    public $method;

    /**
     * Create a new event instance.
     *
     * @param  \Illuminate\Database\Migrations\Migration  $migration
     * @param  string  $method
     * @return void
     */
    public function __construct(Migration $migration, $method)
    {
        $this->method = $method;
        $this->migration = $migration;
    }
}