Laravel 4:PHP 致命错误:调用未定义的方法 Blueprint::int()

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19531058/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 08:35:38  来源:igfitidea点击:

Laravel 4: PHP Fatal error: Call to undefined method Blueprint::int()

phplaravellaravel-4undefinedfatal-error

提问by cshoffie

I've compiled a new installation of Laravel 4 and I'm getting this error after I generate a migration and try to migrate it via artisan:

我已经编译了 Laravel 4 的新安装,在生成迁移并尝试通过 artisan 迁移后出现此错误:

PHP Fatal error: Call to undefined method Illuminate\Database\Schema\Blueprint::int() in /home/casey/Sites/caseyhoffmann.me/laravel4/app/database/migrations/2013_10_22_232234_create_users_table.php on line 22 {"error":{"type":"Symfony\Component\Debug\Exception\FatalErrorException","message":"Call to undefined method Illuminate\Database\Schema\Blueprint::int()","file":"/home/casey/Sites/caseyhoffmann.me/laravel4/app/database/migrations/2013_10_22_232234_create_users_table.php","line":22}}

PHP 致命错误:调用 /home/casey/Sites/caseyhoffmann.me/laravel4/app/database/migrations/2013_10_22_232234_create_users_table.php 中的未定义方法 Illuminate\Database\Schema\Blueprint::int() 22 :{"type":"Symfony\Component\Debug\Exception\FatalErrorException","message":"调用未定义的方法Illuminate\Database\Schema\Blueprint::int()","file":"/home/casey /Sites/caseyhoffmann.me/laravel4/app/database/migrations/2013_10_22_232234_create_users_table.php","line":22}}

I've tried recompiling Laravel but to no avail.

我试过重新编译 Laravel 但无济于事。

Any ideas or suggestions?

有什么想法或建议吗?

回答by Glad To Help

Your int() should be replaced with integer()in the migrations file. Like this:

您的int() 应该integer()在迁移文件中替换为。像这样:

$table->integer('user_id');

$table->integer('user_id');