4

So apparently now I get this weird error when I want to migrate my database

{"error":{"type":"Symfony\\Component\\Debug\\Exception\\FatalErrorException","message":"Class '' not found","file":"C:\\xampp\\htdocs\\l4crm\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Migrations\\Migrator.php","line":301}}[Finished in 1.3s]

Everything used to work of course and it doesn't matter which files I try to migrate (I tried only migrating one table, then another, they all give the same error)

Any ideas? I have been staring myself blind at this for over an hour now.

Also "composer dump-autoload" does not do the trick.

My composer.json autoloads the migrations also.

KennyV
  • 832
  • 1
  • 9
  • 18
  • 2
    Try deleting your `bootstrap/compiled.php` file and test your app. then you can run `php artisan optimize` to create it again. – Antonio Carlos Ribeiro Aug 31 '13 at 17:50
  • 1
    I don't appear to have this file. Only files I have under /bootstrap are autoload.php, paths.php and start.php – KennyV Aug 31 '13 at 19:07
  • Class ' ' not found is weird. Somehow a migration if an empty string class name is getting passed to the migrator. Any non-class files present in the migrations directory? – fideloper Sep 01 '13 at 01:49
  • just the .gitignore which has always been there. I tried removing it just in case and got the same error still I even tried removing all my migrations and leave only the users migration (and tried the same with other migrations) and this still doesn't solve the error. If I don't find the answer I may just create a new project later on and move all the files to the new project and see what happens. I have absolutely no idea where it went wrong though and all my files look good as far as I can tell – KennyV Sep 01 '13 at 08:28

5 Answers5

11

I had the same problem, I searched the internet and I found this solution that you should update your auto-generated classmap (aka autoload) with this composer command:

php composer.phar update

or

composer update    

check this link : I found the solution here

Sherbrow
  • 17,279
  • 3
  • 64
  • 77
Amin Behravesh
  • 374
  • 5
  • 15
9

I appear to have solved the problem.

For easiness sake to determine the order of migrations I had renamed the migration files to something like

1_create_users_table.php
2_create_..._table.php
3_create_..._table.php

and so on. Apparently this gave me the error, it really had to stay in the "yyyy_mm_dd_hhmmss_create_xxx_table.php" format.

KennyV
  • 832
  • 1
  • 9
  • 18
3

if composer dump-autoload doesn't work, check your class name in the migration file. The className should be the same than the file name without the date

Andrei Sfat
  • 8,440
  • 5
  • 49
  • 69
  • Not sure why this was down voted, this was exactly my issue. Thanks! I overlooked this one somehow. – Sethen Jun 28 '14 at 21:36
3

I had the same problem.

For me, composer update doesn't work (in other situations as well) with Windows for weird reasons.

But,

composer dump-autoload

works.

Tim
  • 12,318
  • 7
  • 50
  • 72
Ethan
  • 165
  • 1
  • 9
0

In my case, i had deleted a migration in source files but i didn't on "migrations" table on the database.

Delete the row and refresh migrations and do a "composer dump-autoload -o"