findOrFail($page->id); if ($page->sub_section_id !== null) { throw new \InvalidArgumentException('Страница уже принадлежит другому подразделу'); } $page->section()->associate($subSection); $page->save(); return $page; } }