
Illuminate/Database/QueryException with message 'SQLSTATE[HY000]: General error: 1 table profiles has no column named title (SQL: insert into "profiles" ("title", "description", "user_id", "updated_at", "created_at") values (asd, 123123, 2, 2020-07-31 10:19:03, 2020-07-31 10:19:03))'
This is the error I faced when using '$profile -> save();'
This is the 2020_07_31_074115_create_profiles_table.php:
public function up()
{
Schema::create('profiles', function (Blueprint $table) {
$table->bigIncrements('id');
$table->unsignedBigInteger('user_id');
$table->string('title')->nullable();
$table->text('description')->nullable();
$table->string('url')->nullable();
$table->timestamps();
$table->index('user_id'); //FK
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('profiles');
}
This is the 2014_10_12_000000_create_users_table.php
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('users', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('name');
$table->string('email')->unique();
$table->string('username')->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->rememberToken();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('users');
}
}
table profiles has no column named titlemeans you have the table migrated, but there is not a column named title.