content = $form_model->getItem('content'); $model->user_id = $form_model->getItem('user_id'); $model->title = $form_model->getItem('title'); $model->slug = Slug::createSlug($form_model->getItem('title'), Post::class); if ($model->save()){ return $model; } return false; } public function update(FormModel $form_model, Post $post): false|Post { $post->content = $form_model->getItem('content'); $post->user_id = $form_model->getItem('user_id'); if ($post->save()){ return $post; } return false; } }