DrawMyAttention\ResourceGenerator\Commands\ResourceMakeCommand::buildMigration PHP Method

buildMigration() protected method

protected buildMigration ( $name )
    protected function buildMigration($name)
    {
        $stub = $this->files->get(__DIR__ . '/../Stubs/migration.stub');
        $className = 'Create' . Str::plural($name) . 'Table';
        $stub = str_replace('MIGRATION_CLASS_PLACEHOLDER', $className, $stub);
        $table = strtolower(Str::plural($name));
        $stub = str_replace('TABLE_NAME_PLACEHOLDER', $table, $stub);
        $class = 'App\\' . $name;
        $model = new $class();
        $stub = str_replace('MIGRATION_COLUMNS_PLACEHOLDER', $this->buildTableColumns($model->migrationAttributes()), $stub);
        return $stub;
    }