Nested page (parent page)
I have a resource Page which has id, title, body and parent id.
I would like to create a form, where I can select a "parent" page to the new resource. I
I would like to have 2 levels of pages:
Main page
- Sub page
Should I go another path, or is it possible to do this with parent_id and belongTo relationship? Thank you for your help.
1 Reply
Hm I think I had a wrong approach. I think I have to use options with a query like this
Select::make('parent_id')
->options(Page::where('parent_id', null)->pluck('title', 'id'))
->searchable(),
As I have only 2 levels, it means that I can only select pages, that have no id in parent_id ..
Is there a way to exclude current id in the query?