master

laravel/framework

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

NotificationTableCommand.php

TLDR

This file is a part of the Illuminate\Notifications\Console namespace and contains the NotificationTableCommand class, which extends the MigrationGeneratorCommand class. It is used to create a migration for the notifications table.

Classes

NotificationTableCommand

The NotificationTableCommand class is used to generate a migration for the notifications table. It extends the MigrationGeneratorCommand class and has the following properties and methods:

  • $name: The console command name, set to 'make:notifications-table'.
  • $aliases: The console command name aliases, set to ['notifications:table'].
  • $description: The console command description, set to 'Create a migration for the notifications table'.
  • migrationTableName(): A method that returns the migration table name, set to 'notifications'.
  • migrationStubFile(): A method that returns the path to the migration stub file.
<?php

namespace Illuminate\Notifications\Console;

use Illuminate\Console\MigrationGeneratorCommand;
use Symfony\Component\Console\Attribute\AsCommand;

#[AsCommand(name: 'make:notifications-table')]
class NotificationTableCommand extends MigrationGeneratorCommand
{
    /**
     * The console command name.
     *
     * @var string
     */
    protected $name = 'make:notifications-table';

    /**
     * The console command name aliases.
     *
     * @var array
     */
    protected $aliases = ['notifications:table'];

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Create a migration for the notifications table';

    /**
     * Get the migration table name.
     *
     * @return string
     */
    protected function migrationTableName()
    {
        return 'notifications';
    }

    /**
     * Get the path to the migration stub file.
     *
     * @return string
     */
    protected function migrationStubFile()
    {
        return __DIR__.'/stubs/notifications.stub';
    }
}