Laravel Migration致命错误:调用未定义的方法Illuminate\Database\Schema\Blueprint :: integar()

Has*_*idi -1 php laravel laravel-5.2

我的代码:

use Illuminate\Database\Schema\Blueprint;

use Illuminate\Database\Migrations\Migration;

class CreateTasksTable extends Migration

{
    /**
     * Run the migrations.

     *
     * @return void
     */
    public function up()
    {
        Schema::create('tasks', function (Blueprint $table) {
            $table->increments('id');
             $table->integar('user_id')->index();
            $table->string('name');
            $table->string('food');
            $table->string('quantity');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('tasks');
    }
}
Run Code Online (Sandbox Code Playgroud)

Qaz*_*azi 14

你写错integer拼音,写这篇文章integer,而不是integar

这是我的工作示例代码,请参阅整数行,希望对您有帮助

public function up()
{
    Schema::create('app_type_users', function (Blueprint $table) {
        $table->increments('id');
        $table->integer('user_id')->unsigned()->index();
        $table->integer('app_type_id')->unsigned()->index();
        $table->string('status',1);
        $table->timestamps();
    });
}
Run Code Online (Sandbox Code Playgroud)