Nwidart\Modules\Support\Migrations\SchemaParser::down PHP 메소드

down() 공개 메소드

Render down migration fields.
public down ( ) : string
리턴 string
    public function down()
    {
        $results = '';
        foreach ($this->toArray() as $column => $attributes) {
            $attributes = [head($attributes)];
            $results .= $this->createField($column, $attributes, 'remove');
        }
        return $results;
    }

Usage Example

예제 #1
0
    /** @test */
    public function it_generates_migration_methods_for_down_method()
    {
        $parser = new SchemaParser('username:string, password:integer');
        $expected = <<<TEXT
\t\t\t\$table->dropColumn('username');
\t\t\t\$table->dropColumn('password');

TEXT;
        self::assertEquals($expected, $parser->down());
    }