protected function createMigrationFile()
    {
        $fieldObjects = $this->getFields();

        if (@$fieldObjects['id']) {
            unset($fieldObjects['id']);
        }

        if (@$fieldObjects['created_at'] && @$fieldObjects['updated_at']) {
            $this->addGenericCall((new Base())->timestamps());

            unset($fieldObjects['created_at'], $fieldObjects['updated_at']);
        } // if

        if (@$fieldObjects['deleted_at']) {
            $this->addGenericCall((new Base())->softDeletes());

            unset($fieldObjects['deleted_at']);
        } // if

        $schema = implode(', ', $fieldObjects);

        if (strpos($schema, 'enum') !== false) {
            $this->getCommand()->info(sprintf('Please change the enum field of table "%s" manually.',
                $this->getName()));
        }

        if ($this->isPivotTable()) {
            $tables = array_keys($this->getForeignKeys());

            Artisan::call(
                'make:migration:pivot',
                [
                    'tableOne' => $tables[0],
                    'tableTwo' => $tables[1]
                ]
            );
        } else {
            Artisan::call(
                'make:migration:schema',
                [
                    'name' => "create_{$this->getName()}_table",
                    '--model' => $this->needsLaravelModel(),
                    '--schema' => $fieldObjects ? $schema : ''
                ]
            );

            $migrationFiles = glob(
                database_path('migrations') . DIRECTORY_SEPARATOR . "*_create_{$this->getName()}_table.php"
            );
        }

        return @$migrationFiles ? end($migrationFiles) : '';
    }
protected function createMigrationFile()
    {
        $fieldObjects = $this->getFields();

        if (@$fieldObjects['id']) {
            unset($fieldObjects['id']);
        }

        if (@$fieldObjects['created_at'] && @$fieldObjects['updated_at']) {
            $this->addGenericCall((new Base())->timestamps());

            unset($fieldObjects['created_at'], $fieldObjects['updated_at']);
        } // if

        if (@$fieldObjects['deleted_at']) {
            $this->addGenericCall((new Base())->softDeletes());

            unset($fieldObjects['deleted_at']);
        } // if

        $schema = implode(', ', $fieldObjects);

        if (strpos($schema, 'enum') !== false) {
            $this->getCommand()->info(sprintf('Please change the enum field of table "%s" manually.',
                $this->getName()));
        }

        if ($this->isPivotTable()) {
            $tables = array_keys($this->getForeignKeys());

            Artisan::call(
                'make:migration:pivot',
                [
                    'tableOne' => $tables[0],
                    'tableTwo' => $tables[1]
                ]
            );
        } else {
            Artisan::call(
                'make:migration:schema',
                [
                    'name' => "create_{$this->getName()}_table",
                    '--model' => $this->needsLaravelModel(),
                    '--schema' => $fieldObjects ? $schema : ''
                ]
            );

            $migrationFiles = glob(
                database_path('migrations') . DIRECTORY_SEPARATOR . "*_create_{$this->getName()}_table.php"
            );
        }

        return @$migrationFiles ? end($migrationFiles) : '';
    }
protected function createMigrationFile ( ) { $ fieldObjects = $ this -> getFields ( ) ; if ( @ $ fieldObjects [ 'id' ] ) { unset ( $ fieldObjects [ 'id' ] ) ; } if ( @ $ fieldObjects [ 'created_at' ] && @ $ fieldObjects [ 'updated_at' ] ) { $ this -> addGenericCall ( ( new Base ( ) ) -> timestamps ( ) ) ; unset ( $ fieldObjects [ 'created_at' ] , $ fieldObjects [ 'updated_at' ] ) ; } // if if ( @ $ fieldObjects [ 'deleted_at' ] ) { $ this -> addGenericCall ( ( new Base ( ) ) -> softDeletes ( ) ) ; unset ( $ fieldObjects [ 'deleted_at' ] ) ; } // if $ schema = implode ( ', ' , $ fieldObjects ) ; if ( strpos ( $ schema , 'enum' ) !== false ) { $ this -> getCommand ( ) -> info ( sprintf ( 'Please change the enum field of table "%s" manually.' , $ this -> getName ( ) ) ) ; } if ( $ this -> isPivotTable ( ) ) { $ tables = array_keys ( $ this -> getForeignKeys ( ) ) ; Artisan :: call ( 'make:migration:pivot' , [ 'tableOne' => $ tables [ 0 ] , 'tableTwo' => $ tables [ 1 ] ] ) ; } else { Artisan :: call ( 'make:migration:schema' , [ 'name' => "create_{$this->getName()}_table" , '--model' => $ this -> needsLaravelModel ( ) , '--schema' => $ fieldObjects ? $ schema : '' ] ) ; $ migrationFiles = glob ( database_path ( 'migrations' ) . DIRECTORY_SEPARATOR . "*_create_{$this->getName()}_table.php" ) ; } return @ $ migrationFiles ? end ( $ migrationFiles ) : '' ; }
Creates the migration file for the given table.
@return mixed|string
@todo softDeletes, timestamps
Creates the migration file for the given table .