I namespaced my whole package successfully but I can not get namespaced migrations to work. In the autoload_classmap.php the migration classes are nicely namespaced, but the Migrator is not looking for the migration classes within the namespace. How to get the migrator to search for the migrations within the namespace?
The migration file
<?php namespace Atomend\Aeuser;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Schema, User;
class UsersTable extends Migration {
public function up() {
Schema::create("users", function(Blueprint $table) {
$table
->increments("id");
autoload_classmap.php
'Atomend\\Aeuser\\UsersTable' => $baseDir . '/src/migrations/2014_04_21_184359_users_table.php',
Terminal error
PHP Fatal error: Class 'UsersTable' not found in
This is logical since the UsersTable is in the Atomend\Aeuser
namespace.
Issuing the migration
php artisan migrate --bench="atomend/aeuser"`
So to be clear, when losing the namespace everything works fine and dandy.
Laravel migrator doesn't play nice with namespaced migrations. Your best bet in this case is to subclass and substitute the Migrator class, like Christopher Pitt explains in his blog post: https://medium.com/laravel-4/6e75f99cdb0.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With