Laravel 4迁移:找不到类异常 [英] Laravel 4 migration: class not found exception
问题描述
显然,现在我想迁移数据库时会出现这个奇怪的错误
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.
"composer dump-autoload"也无法解决问题.
Also "composer dump-autoload" does not do the trick.
我的composer.json也自动加载迁移.
My composer.json autoloads the migrations also.
推荐答案
我似乎已经解决了问题.
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
,依此类推.显然这给了我错误,它实际上必须保持为" yyyy_mm_dd_hhmmss_create_xxx_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.
这篇关于Laravel 4迁移:找不到类异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!