| @@ 39-52 (lines=14) @@ | ||
| 36 | * @param Closure $callback |
|
| 37 | * @return \Illuminate\Database\Schema\Blueprint |
|
| 38 | */ |
|
| 39 | public function create($table, Closure $callback) |
|
| 40 | { |
|
| 41 | $blueprint = $this->createBlueprint($table); |
|
| 42 | ||
| 43 | $blueprint->create(); |
|
| 44 | ||
| 45 | $callback($blueprint); |
|
| 46 | ||
| 47 | $this->build($blueprint); |
|
| 48 | ||
| 49 | $this->comment->setComments($blueprint); |
|
| 50 | ||
| 51 | $this->helper->createAutoIncrementObjects($blueprint, $table); |
|
| 52 | } |
|
| 53 | ||
| 54 | /** |
|
| 55 | * Changes an existing table on the schema. |
|
| @@ 61-78 (lines=18) @@ | ||
| 58 | * @param Closure $callback |
|
| 59 | * @return \Illuminate\Database\Schema\Blueprint |
|
| 60 | */ |
|
| 61 | public function table($table, Closure $callback) |
|
| 62 | { |
|
| 63 | $blueprint = $this->createBlueprint($table); |
|
| 64 | ||
| 65 | $callback($blueprint); |
|
| 66 | ||
| 67 | foreach ($blueprint->getCommands() as $command) { |
|
| 68 | if ($command->get('name') == 'drop') { |
|
| 69 | $this->helper->dropAutoIncrementObjects($table); |
|
| 70 | } |
|
| 71 | } |
|
| 72 | ||
| 73 | $this->build($blueprint); |
|
| 74 | ||
| 75 | $this->comment->setComments($blueprint); |
|
| 76 | } |
|
| 77 | ||
| 78 | /** |
|
| 79 | * Create a new command set with a Closure. |
|
| 80 | * |
|
| 81 | * @param string $table |
|