Last active
October 21, 2015 13:20
-
-
Save kirkbushell/6d425001ef9599dbdc92 to your computer and use it in GitHub Desktop.
Laravel 5 migrations for packages
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Illuminate\Console\Command; | |
use Illuminate\Container\Container; | |
class PackageMigrationCommand extends Command | |
{ | |
/** | |
* Name of the command. | |
* | |
* @param string | |
*/ | |
protected $name = 'package:migrate'; | |
/** | |
* Necessary to let people know, in case the name wasn't clear enough. | |
* | |
* @param string | |
*/ | |
protected $description = 'Migrate my incredibly necessary package migration files.'; | |
/** | |
* Setup the application container as we'll need this for running migrations. | |
*/ | |
public function __construct(Container $app) | |
{ | |
$this->app = $app; | |
} | |
/** | |
* Run the package migrations. | |
*/ | |
public function handle() | |
{ | |
$migrations = $this->app->make('migration.repository'); | |
$migrations->createRepository(); | |
$migrator = $this->app->make('migrator'); | |
$migrator->run(__DIR__.'/../src/migrations'); | |
$migrator->run(__DIR__.'/Fixtures/Migrations'); | |
} | |
} |
Me too...
make('migration.repository');
$migrations->createRepository();
$migrator = $this->app->make('migrator');
$migrator->run(__DIR__.'/../src/migrations');
$migrator->run(__DIR__.'/Fixtures/Migrations');
}
```
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I get an error when I run this in latest version. Argument 1 must be an instance of Illuminate/Container, none given.