简体   繁体   中英

Laravel 4 Migration Error

I'm getting the following error when trying to create migrations for my laravel 4 installation. The file gets created but it outputs the following error.

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

It doesn't seem that there are any other people having the same problem.

Also getting this error when i commit the migration

{"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}}

Thanks in advance.

In you're migration you have the function up. In this function there will be something like:

Schema::create('users', function (Blueprint $table) {
    $table->increments('id');
});

It would seem that you did not do define the callback with the variable $table. Please add Blueprint $table and it should work.

In that case remember to import the right namespaces:

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM