| Total Complexity | 7 |
| Total Lines | 34 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 5 | trait HasMigrations |
||
| 6 | { |
||
| 7 | use HasModule; |
||
| 8 | |||
| 9 | /** |
||
| 10 | * Directory where module migrations are located |
||
| 11 | * |
||
| 12 | * @return string |
||
| 13 | */ |
||
| 14 | public static function migrations() |
||
| 15 | { |
||
| 16 | return implode(DIRECTORY_SEPARATOR, [static::relativePath(), 'Database', 'Migrations']); |
||
| 17 | } |
||
| 18 | |||
| 19 | final public function migrate() |
||
| 20 | { |
||
| 21 | $paths = $this->migrations(); |
||
| 22 | |||
| 23 | foreach (is_array($paths)? $paths: [$paths] as $path) { |
||
| 24 | \Illuminate\Support\Facades\Artisan::call('migrate', ['--path' => $path, '--force' => true]); |
||
| 25 | } |
||
| 26 | |||
| 27 | return $this; |
||
| 28 | } |
||
| 29 | |||
| 30 | final public function rollback() |
||
| 39 | } |
||
| 40 | } |
||
| 41 |