| @@ 38-51 (lines=14) @@ | ||
| 35 | * @param Closure $callback |
|
| 36 | * @return \Illuminate\Database\Schema\Blueprint |
|
| 37 | */ |
|
| 38 | public function create($table, Closure $callback) |
|
| 39 | { |
|
| 40 | $blueprint = $this->createBlueprint($table); |
|
| 41 | ||
| 42 | $blueprint->create(); |
|
| 43 | ||
| 44 | $callback($blueprint); |
|
| 45 | ||
| 46 | $this->build($blueprint); |
|
| 47 | ||
| 48 | $this->comment->setComments($blueprint); |
|
| 49 | ||
| 50 | $this->helper->createAutoIncrementObjects($blueprint, $table); |
|
| 51 | } |
|
| 52 | ||
| 53 | /** |
|
| 54 | * Create a new command set with a Closure. |
|
| @@ 75-90 (lines=16) @@ | ||
| 72 | * @param Closure $callback |
|
| 73 | * @return \Illuminate\Database\Schema\Blueprint |
|
| 74 | */ |
|
| 75 | public function table($table, Closure $callback) |
|
| 76 | { |
|
| 77 | $blueprint = $this->createBlueprint($table); |
|
| 78 | ||
| 79 | $callback($blueprint); |
|
| 80 | ||
| 81 | foreach ($blueprint->getCommands() as $command) { |
|
| 82 | if ($command->get('name') == 'drop') { |
|
| 83 | $this->helper->dropAutoIncrementObjects($table); |
|
| 84 | } |
|
| 85 | } |
|
| 86 | ||
| 87 | $this->build($blueprint); |
|
| 88 | ||
| 89 | $this->comment->setComments($blueprint); |
|
| 90 | } |
|
| 91 | ||
| 92 | /** |
|
| 93 | * Drop a table from the schema. |
|