Skip to content

Commit

Permalink
allow to set excepted fields
Browse files Browse the repository at this point in the history
  • Loading branch information
Gravitano committed Jan 6, 2016
1 parent f4ce3ab commit 3e15205
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion FormDumpers/TableDumper.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ class TableDumper
*/
protected $table;

/**
* The array of excepted fields.
*
* @var array
*/
protected $except = [];

/**
* The constructor.
*
Expand All @@ -37,6 +44,19 @@ public static function make($table)
return new static($table);
}

/**
* Set excepted fields.
*
* @param array|string $except
* @return self
*/
public function except($except)
{
$this->except = $except;

return $this;
}

/**
* Get table name.
*
Expand Down Expand Up @@ -67,7 +87,9 @@ public function toSchema()
$schema = [];

foreach ($this->getColumns() as $column) {
$schema[] = $column->getName().':'.strtolower($column->getType());
if (! in_array($name = $column->getName(), $this->except)) {
$schema[] = $name.':'.strtolower($column->getType());
}
}

return implode(', ', $schema);
Expand Down

0 comments on commit 3e15205

Please sign in to comment.