for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Webfactor\Laravel\Generators\Schemas\Naming;
use Carbon\Carbon;
use Webfactor\Laravel\Generators\Contracts\NamingAbstract;
class Migration extends NamingAbstract
{
protected $fileName;
/**
* Migration constructor.
* @param string $entity
*/
public function __construct(string $entity)
parent::__construct($entity);
$this->setFileName();
}
* @return string
public function getClassName(): string
return 'Create' . ucfirst(str_plural($this->entity)) . 'Table';
public function getTableName(): string
return snake_case(str_plural($this->entity));
* @return void
public function setFileName(): void
$this->fileName = Carbon::now()->format('Y_m_d_His') . '_' . snake_case($this->getClassName()) . '.php';
public function getFileName(): string
return $this->fileName;
public function getPath(): string
return database_path('migrations');
public function getRelativeFilePath(): string
return 'database/migrations/'.$this->getFileName();
public function getStub(): string
return __DIR__ . '/../../../stubs/migration.stub';