Есть поле affiliated_facility, которое находится в массиве, и я пытаюсь обновить мои значения:
Код моего контроллера:
<?php
$affiliated_facility = implode(",", $userProfile['affiliated_facility']);
$userBasicInfoId = UserBasicInfo::where('user_id', $userProfile['id'])->value('id')->update([
'work_phone' => $userProfile['work_phone'],
'fax' => $userProfile['fax'],
'extension' => $userProfile['extension'],
'primary_facility' => $userProfile['primary_facility'],
'employed_by' => $userProfile['employed_by'],
'emergency_phone' => $userProfile['emergency_phone'],
'designation' => $userProfile['designation'],
'department' => $userProfile['department'],
'employment_type' => $userProfile['employment_type'],
'biography' => $userProfile['biography'],
'hiring_date' => $userProfile['hiring_date'],
'from' => $userProfile['from'],
'to' => $userProfile['to'],
'affiliated_facility' => $affiliated_facility]); // this is in array so i used implode in top of this code
if ($userBasicInfoId) {
$userBasicInfo = $this->userBasicInfo->find($userBasicInfoId);
$userBasicInfo->fill($userProfile)->save();
} else {
$userBasicInfo = $this->userBasicInfo->create($request->only($this->userBasicInfo->getModel()->fillable));
}
?>
Но когда я нажимаю на мой запрос, он говорит
Вызов функции-члена update () для целого числа
В моем коде есть некоторые ошибки, я хочу обновить свою запись, и есть одно поле, которое находится в массиве
"affiliated_facility": [1,2]
может кто-нибудьПожалуйста, помогите мне изменить этот код, я застрял на этом, ваша помощь будет высоко оценена!
Заранее спасибо