簡體   English   中英

Laravel 4遷移錯誤

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM