can someone please help me with this one? I'm new to Laravel and when I try to do:

```
php artisan migrate

```

I get the error:

> 
> Illuminate\Database\QueryException : SQLSTATE[HY000]: General error: 1215 Cannot add foreign key constraint (SQL: alter table posts add constraint posts\_author\_id\_foreign foreign key (author\_id) references users (id) on delete restrict)
> 
> 
> 

and this is the post table content:

```
<?php

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

class CreatePostsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('posts', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('author_id')->unsigned();
            $table->foreign('author_id')->references('id')->on('users')->onDelete('restrict');
            $table->string('title');
            $table->string('slug')->unique();
            $table->text('excerpt');
            $table->text('body');
            $table->string('image')->nullable();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('posts');
    }
}

```

I have noticed that when I comment this line:

```
$table->foreign('author_id')->references('id')->on('users')->onDelete('restrict');

```

the error is gone, so I guess the problem is in that line. So, can someone please tell me what will be the correct syntax or how to fix it?