我的专家设置在一页中添加和编辑。一切正常但有一个问题。当我编辑所有内容时,它不会保存我编辑的内容。我不明白为什么。专家有一对一的表(profile_settings)。
配置文件设置迁移
Schema::create('profile__settings', function (Blueprint $table) {
$table->id();
$table->integer('user_id')->unsigned();
$table->string('first_name')->nullable();
$table->string('last_name')->nullable();
$table->string('phone_number')->nullable();
$table->string('gender')->nullable();
$table->string('date_of_birth')->nullable();
$table->text('about_me')->nullable();
$table->string('address')->nullable();
$table->string('city')->nullable();
$table->string('country')->nullable();
$table->string('postal_code')->nullable();
$table->timestamps();
});
配置文件_设置模型
class Profile_Settings extends Model
{
// Fill in db
protected $fillable = [
'first_name', 'last_name', 'phone_number',
'gender', 'date_of_birth', 'about_me',
'address', 'city', 'country', 'postal_code',
];
// Profile settigns model belongs to User
public function user(){
return $this->belongsTo(User::class);
}
}
用户模型(专家)
class User extends Authenticatable
{
use Notifiable;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'name', 'email', 'password',
];
/**
* The attributes that should be hidden for arrays.
*
* @var array
*/
protected $hidden = [
'password', 'remember_token',
];
/**
* The attributes that should be cast to native types.
*
* @var array
*/
protected $casts = [
'email_verified_at' => 'datetime',
];
HUX布斯
慕哥6287543