user_id = $form_model->getItem('user_id'); $model->message = $form_model->getItem('message'); $model->is_read = $form_model->getItem('is_read'); $model->data = $form_model->getItem('data'); $model->type = $form_model->getItem('type'); $model->subject = $form_model->getItem('subject'); $model->status = $form_model->getItem('status'); if ($model->save()) { return $model; } return false; } public function update(FormModel $form_model, Notification $notification): false|Notification { $notification->user_id = $form_model->getItem('user_id'); $notification->message = $form_model->getItem('message'); $notification->is_read = $form_model->getItem('is_read'); $notification->data = $form_model->getItem('data'); $notification->type = $form_model->getItem('type'); $notification->subject = $form_model->getItem('subject'); $notification->status = $form_model->getItem('status'); if ($notification->save()) { return $notification; } return false; } // public function createOptionArr(): array // { // foreach (Option::all()->toArray() as $option) { // $optionArr[$option['id']] = $option['key']; // } // if (!empty($optionArr)) { // return $optionArr; // } // return []; // } }