src/Migrations/SyntaxBuilder.php
private function createSchemaForDownMethod($schema, $meta)
    {
        // If the user created a table, then for the down
        // method, we should drop it.
        if ($meta['action'] == 'create') {
            return sprintf("Schema::drop('%s');", $meta['table']);
        }

        // If the user added columns to a table, then for
        // the down method, we should remove them.
        if ($meta['action'] == 'add') {
            $fields = $this->constructSchema($schema, 'Drop');

            return $this->insert($fields)->into($this->getChangeSchemaWrapper());
        }

        // If the user removed columns from a table, then for
        // the down method, we should add them back on.
        if ($meta['action'] == 'remove') {
            $fields = $this->constructSchema($schema);

            return $this->insert($fields)->into($this->getChangeSchemaWrapper());
        }

        // Otherwise, we have no idea how to proceed.
        throw new GeneratorException;
    }
private function createSchemaForDownMethod($schema, $meta)
    {
        // If the user created a table, then for the down
        // method, we should drop it.
        if ($meta['action'] == 'create') {
            return sprintf("Schema::drop('%s');", $meta['table']);
        }

        // If the user added columns to a table, then for
        // the down method, we should remove them.
        if ($meta['action'] == 'add') {
            $fields = $this->constructSchema($schema, 'Drop');

            return $this->insert($fields)->into($this->getChangeSchemaWrapper());
        }

        // If the user removed columns from a table, then for
        // the down method, we should add them back on.
        if ($meta['action'] == 'remove') {
            $fields = $this->constructSchema($schema);

            return $this->insert($fields)->into($this->getChangeSchemaWrapper());
        }

        // Otherwise, we have no idea how to proceed.
        throw new GeneratorException;
    }
private function createSchemaForDownMethod ( $ schema , $ meta ) { // If the user created a table, then for the down // method, we should drop it. if ( $ meta [ 'action' ] == 'create' ) { return sprintf ( "Schema::drop('%s');" , $ meta [ 'table' ] ) ; } // If the user added columns to a table, then for // the down method, we should remove them. if ( $ meta [ 'action' ] == 'add' ) { $ fields = $ this -> constructSchema ( $ schema , 'Drop' ) ; return $ this -> insert ( $ fields ) -> into ( $ this -> getChangeSchemaWrapper ( ) ) ; } // If the user removed columns from a table, then for // the down method, we should add them back on. if ( $ meta [ 'action' ] == 'remove' ) { $ fields = $ this -> constructSchema ( $ schema ) ; return $ this -> insert ( $ fields ) -> into ( $ this -> getChangeSchemaWrapper ( ) ) ; } // Otherwise, we have no idea how to proceed. throw new GeneratorException ; }
Construct the syntax for a down field.

@param  array $schema
@param  array $meta
@return string
@throws GeneratorException
Construct the syntax for a down field .