BatchesTableCommand.php
TLDR
This file defines the BatchesTableCommand
class, which is responsible for creating a migration file for the batches database table used in the Queue system.
Classes
BatchesTableCommand
The BatchesTableCommand
class extends the MigrationGeneratorCommand
class and provides the functionality to create a migration file for the batches database table. It is a command-line command that can be executed using the make:queue-batches-table
command.
The properties of the class are:
-
$name
: The console command name. -
$aliases
: The console command name aliases. -
$description
: The console command description.
The methods of the class are:
-
migrationTableName()
: Returns the migration table name, which is retrieved from the Laravel configuration filequeue.batching.table
, or defaults to'job_batches'
if not specified. -
migrationStubFile()
: Returns the path to the migration stub file, which is located in the same directory as theBatchesTableCommand
file and namedbatches.stub
.
<?php
namespace Illuminate\Queue\Console;
use Illuminate\Console\MigrationGeneratorCommand;
use Symfony\Component\Console\Attribute\AsCommand;
#[AsCommand(name: 'make:queue-batches-table')]
class BatchesTableCommand extends MigrationGeneratorCommand
{
/**
* The console command name.
*
* @var string
*/
protected $name = 'make:queue-batches-table';
/**
* The console command name aliases.
*
* @var array
*/
protected $aliases = ['queue:batches-table'];
/**
* The console command description.
*
* @var string
*/
protected $description = 'Create a migration for the batches database table';
/**
* Get the migration table name.
*
* @return string
*/
protected function migrationTableName()
{
return $this->laravel['config']['queue.batching.table'] ?? 'job_batches';
}
/**
* Get the path to the migration stub file.
*
* @return string
*/
protected function migrationStubFile()
{
return __DIR__.'/stubs/batches.stub';
}
}