当我尝试为我的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}}提前谢谢。
发布于 2016-02-11 22:55:28
在您的迁移过程中,您已经启动了该功能。在此函数中,将包含类似以下内容的内容:
Schema::create('users', function (Blueprint $table) {
$table->increments('id');
});看起来您没有使用变量$table定义回调。请添加Blueprint $table,它应该可以工作。
在这种情况下,请记住导入正确的名称空间:
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;https://stackoverflow.com/questions/24593721
复制相似问题