master

laravel/framework

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

CacheTableCommand.php

TLDR

This file defines the CacheTableCommand class, which is a command used to create a migration for the cache database table.

Classes

CacheTableCommand

The CacheTableCommand class extends the MigrationGeneratorCommand class and is responsible for creating a migration for the cache database table. It has the following properties:

  • $name: The console command name. It is set to 'make:cache-table'.
  • $aliases: The console command name aliases. It is set to ['cache:table'].
  • $description: The console command description. It is set to 'Create a migration for the cache database table'.

The CacheTableCommand class also has the following methods:

  • migrationTableName(): Retrieves the name of the migration table. It returns 'cache'.
  • migrationStubFile(): Retrieves the path to the migration stub file. It returns '__DIR__.'/stubs/cache.stub'.
<?php

namespace Illuminate\Cache\Console;

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

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

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

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

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

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