I am in big problem. I am trying to rum php artisan migrate
to generate table migration, but i am getting
[2016-03-08 05:49:01] local.ERR
Check all of your service providers. In one of the boot methods, a model may be called, the migration to which has not yet been run.
Check your migration file, maybe you are using Schema::table, like this:
Schema::table('table_name', function ($table) {
// ...
});
If you want to create a new table you must use Schema::create:
Schema::create('table_name', function ($table) {
// ...
});
Laracast More information in this link.
In case anybody else runs in to this I just had the same issue and the reason it was happening was because I had created several commands and then needed to rollback my db to rerun the migrations.
To fix it I had to comment out the contents of the
protected $commands = []
in app\Console\Kernel.php file.
Phew!!!! :-)
I had this problem when I tried to migrate new database. I had a function in AuthServiceProvider which selects all permissions. I commented that function and the problem was fixed.
The problem is that the foreign keys are added but cannot find the table because it hasn't been created.
1) make tables without foreign keys
2) Make a 9999_99_99_999999_create_foreign_keys.php file
3) put there the foreign keys you want. With the 999..9 .php file it makes sure that it does the foreign keys last after the tables have been made.
4) You have added the tables first and then added the foreign keys. This will work.
I ran it to a similar problem.
Seems like I executed a Model query in the routes file. So it executes every time, even before running the actual migration.
//Problematic code
Route::view('users', 'users', [ 'users' => User::all() ]);
So I changed it to
Route::get('/users', function () {
return view('users', ['users' => User::all()]);
});
And everything works fine. Make sure that no Model queries is excecuted on the execution path and then try migrating.