[英]Laravel 4 Migration Error
尝试为laravel 4安装创建迁移时出现以下错误。 文件已创建,但输出以下错误。
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
似乎没有其他人遇到相同的问题。
当我提交迁移时也会出现此错误
{"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}}
提前致谢。
在迁移过程中,您可以使用该功能。 在此功能中,将出现以下内容:
Schema::create('users', function (Blueprint $table) {
$table->increments('id');
});
似乎您没有使用变量$ table定义回调。 请添加Blueprint $table
,它应该可以工作。
在这种情况下,请记住导入正确的名称空间:
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.