使用消息 'SQLSTATE[HY000] 照亮/数据库/QueryException:一般错误:1 表配置文件没有名为标题的列(SQL:插入“配置文件”(“标题”,“描述”,“user_id”,“updated_at”,“ create_at") 值 (asd, 123123, 2, 2020-07-31 10:19:03, 2020-07-31 10:19:03))'
这是我在 '$profile -> save();' 时遇到的错误 我正在根据以下链接学习 Laravel: https://www.youtube.com/watch?v =ImtZ5yENzgE&list=WL&index=45&t=81s
这是 2020_07_31_074115_create_profiles_table.php
{
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');
}
这是 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');
}
}
繁星coding