-4

I am getting these errors while creating a pivot table and migrating it. This is my code for pivot table.

<?php

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

class HotelUserTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('hotel_user', function (Blueprint $table) {
            $table->integer('hotel_id')->unsigned();
            $table->integer('user_id')->unsigned();
            $table->foreign('hotel_id')->refrences('id')->on('hotels');
            $table->foreign('user_id')->refrences('id')->on('users');
        });
    }

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

In Connection.php line 664:

SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')' at line 1 (SQL: alter table hotel _user add constraint hotel_user_hotel_id_foreign foreign key (hotel_id) references hotels ())

In Connection.php line 452:

SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')' at line 1

aimme
  • 6,385
  • 7
  • 48
  • 65
  • 3
    images of code do not help you – Funk Forty Niner Jan 17 '18 at 14:40
  • 2
    Welcome to Stack Overflow! [Please don't post your code as an image.](//meta.stackoverflow.com/q/285551) – Blue Jan 17 '18 at 14:40
  • I highly recommend reading [Writing the Perfect Question](https://codeblog.jonskeet.uk/2010/08/29/writing-the-perfect-question/) and more specifically the "Spelling, grammar and formatting" section. I've corrected this post, and fixed some of the common mistakes, but on future posts reading this article would go a long way to making high quality posts for future visitors. – Blue Jan 17 '18 at 14:41
  • see my answer. its typo references – aimme Jan 17 '18 at 14:52

1 Answers1

0

check the spelling of references

change refrences to references

aimme
  • 6,385
  • 7
  • 48
  • 65