Ho do you include migrations and seeds that are in their own paths, when using the regular artisan migrate and seed commands?
I'd like to include the migrations and seeds in the following manner;
app{namespace}{module-name}{folders}
In the example above, here is where the migrations would be..
app\MyNameSpace\Page\Database\Migrations{migration files}
app\MyNameSpace\Page\Database\Seeders{seeder files}
I realize that there is a whole subject on package development but I'd like to primarily just keep the bulk of the code base within its own folder.
<?php
class DatabaseSeeder extends Seeder
{
public function run() {
$this->call('App\MyNameSpace\Page\Database\Migrations\SomeSeederClass');
}
}
<?php namespace App\MyNameSpace\Page\Database\Migrations;
use Illuminate\Database\Seeder as Seeder;
Class SomeSeederClass extends Seeder
{
public function run () {
// Your migration here
}
}
Note: I did this out my head, so I hope it's correct!
Yes that likely tackles the seeder, however, the migration is done differently, the MigrateCommand extends a BaseCommand which returns;
$this->laravel->databasePath().'/migrations';
So this is hard set to that folder in the database path. I have installed caffeinated/module package and it registers a service provider that binds a migration command via the console so Im starting to think that without hacking it there is no way to register additional locations for migration classes.
At first i had tried to simply add a classmap in "autoload" but "database" is there for other purposes other than migrations.
public function up() {
$this->down();
Schema::create('users', function (Blueprint $table) {
$table->increments('id');
});
}
public function down() {
Schema::dropIfExists('users');
}