| @@ 23-34 (lines=12) @@ | ||
| 20 | { |
|
| 21 | $path = $this->config->getSeedDirectory($name.'.php'); |
|
| 22 | ||
| 23 | if (!file_exists($path)) { |
|
| 24 | $this->makeDirectoryStructure([ |
|
| 25 | 'database' => $this->config->getDatabaseDirectory(), |
|
| 26 | 'seeds' => $this->config->getSeedDirectory(), |
|
| 27 | ], $this->output); |
|
| 28 | ||
| 29 | $this->writeFile($path, $this->getStub($name)); |
|
| 30 | ||
| 31 | $this->output->writeInfo("Created seeder {$name}."); |
|
| 32 | ||
| 33 | return $path; |
|
| 34 | } |
|
| 35 | ||
| 36 | throw WriteError::commandExists($name); |
|
| 37 | } |
|
| @@ 24-38 (lines=15) @@ | ||
| 21 | { |
|
| 22 | $className = $this->getClassName($name); |
|
| 23 | ||
| 24 | if (!class_exists($className)) { |
|
| 25 | $this->makeDirectoryStructure([ |
|
| 26 | 'database' => $this->config->getDatabaseDirectory(), |
|
| 27 | 'migrations' => $this->config->getMigrationDirectory(), |
|
| 28 | ], $this->output); |
|
| 29 | ||
| 30 | $this->writeFile( |
|
| 31 | $path = $this->getSavePath($name), |
|
| 32 | $this->getStub($className, $create) |
|
| 33 | ); |
|
| 34 | ||
| 35 | $this->output->writeInfo("Created migration {$name}."); |
|
| 36 | ||
| 37 | return $path; |
|
| 38 | } |
|
| 39 | ||
| 40 | throw WriteError::classExists($className); |
|
| 41 | } |
|