Skip to content

Instantly share code, notes, and snippets.

@kirkbushell
Last active October 21, 2015 13:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kirkbushell/6d425001ef9599dbdc92 to your computer and use it in GitHub Desktop.
Save kirkbushell/6d425001ef9599dbdc92 to your computer and use it in GitHub Desktop.
Laravel 5 migrations for packages
<?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');
}
}
@Truemedia
Copy link

I get an error when I run this in latest version. Argument 1 must be an instance of Illuminate/Container, none given.

@Krato
Copy link

Krato commented Jun 11, 2015

Me too...

@jooorooo
Copy link

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