首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Laravel 4迁移错误

Laravel 4迁移错误
EN

Stack Overflow用户
提问于 2014-07-06 15:40:24
回答 1查看 155关注 0票数 0

当我尝试为我的laravel 4安装创建迁移时,我得到了以下错误。文件被创建,但它输出以下错误。

代码语言:javascript
复制
Created Migration: 2014_07_06_073213_create-users-table
Generating optimized class loader
Compiling common classes
{"error":
{"type":"Symfony\\Component\\Debug\\Exception\\FatalErrorException","message":"Class 'ClassPreloader\\Command\\PreCompileCommand' not found","file":"\/home\/name123\/domain.com\/laravel\/vendor\/laravel\/framework\/src\/Illuminate\/Foundation\/Console\/OptimizeCommand.php","line":113}}[warehouse]

$ php artisan migrate:make create-users-table

似乎没有其他人有同样的问题。

提交迁移时也会遇到此错误

代码语言:javascript
复制
{"error":{"type":"Symfony\\Component\\Debug\\Exception\\FatalErrorException","message":"Call to a member function increments() on a non-object","file":"\/home\/dandel26\/danieldelcore.com\/laravel\/app\/database\/migrations\/2014_06_29_092641_create_users_table.php","line":15}}

提前谢谢。

EN

回答 1

Stack Overflow用户

发布于 2016-02-11 22:55:28

在您的迁移过程中,您已经启动了该功能。在此函数中,将包含类似以下内容的内容:

代码语言:javascript
复制
Schema::create('users', function (Blueprint $table) {
    $table->increments('id');
});

看起来您没有使用变量$table定义回调。请添加Blueprint $table,它应该可以工作。

在这种情况下,请记住导入正确的名称空间:

代码语言:javascript
复制
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/24593721

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档