Почему вкладка пропала в октябре cms?
Я пытаюсь продлить плагин пользователя в октябре CMS. когда я добавляю некоторый код в свой плагин Profile, вкладка Profile в плагине User исчезает. это мой код
//Profile Model
public static function getFromUser($user)
{
if ($user->profile) {
return $user->profile;
}
$profile = new static;
$profile->user = $user;
$profile->save();
$user->profile = $profile;
return $profile;
}
//Plugin.php
public function boot()
{
UserModel::extend(function ($model) {
$model->hasOne['profile'] = ['Sepehr\Profile\Models\Profile'];
});
UserController::extendFormFields(function ($form, $model, $context) {
//when i add these code my Profile's tab is gone
if (!$model instanceof UserModel) {
return;
}
if (!$model->exists) {
return;
}
ProfileModel::getFromUser($model);
//when i add these code my Profile's tab is gone
$form->addTabFields([
'profile[bio]' => [
'label' => 'bio',
'tab' => 'Profile',
],
'profile[facebook]' => [
'label' => 'facebook',
'tab' => 'Profile',
'type' => 'textarea'
],
]);
});
}
без этих строк вкладка возвращается, но когда я нажимаю на кнопку сохранения и закрываю, возникает ошибка: 'profile' попробуйте добавить его в $jsonable