$title, 'layout' => $layout, ]); } public function update($id, $title, $layout) { $section = Section::find($id); if ($section) { $section->title = $title; $section->layout = $layout; $section->update(); return $section; } return false; } public function destroy($id) { SectionItem::where('section_id', $id)->delete(); SectionCategory::where('section_id', $id)->delete(); return Section::destroy($id); } }