I am trying to get specific data from the database by using column SongID
when a user clicks a link but I am getting this error:
SQLSTATE[42
I am running laravel 5.8 and i experienced the same problem. The solution that worked for me is as follows :
I used unsignedBigInteger('user_id') to define the foreign referenced key.
Schema::create('generals', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('general_name');
$table->string('status');
$table->timestamps();
});
Schema::create('categories', function (Blueprint $table) {
$table->bigIncrements('id');
$table->unsignedBigInteger('general_id');
$table->foreign('general_id')->references('id')->on('generals');
$table->string('category_name');
$table->string('status');
$table->timestamps();
});
I hope this helps out.