->getRelated for menu didnt work.
I follow this manual
https://twillcms.com/guides/page-builder-with-blade/adding-navigation.html
I do all the thinks which is there,
I do some links to my pages in twill
I will be see a relatitons in twill table
But when I call in compoment
$link->getRelated('page')->first()->slug}}
I have this error Attempt to read property "slug" on null
In my code.
The MenuPageLink.php
is use HasRelated;
In MenuPageLinkRepository.php
is protected $relatedBrowsers = ['page'];
and use HandleNesting;
In MenuPageLinkController
is $form->add(Browser::make()->name('page')->modules([Page::class]));
I didnt understod what is wrong and why the getRelated()
didnt get the relations.
Thx for answer2 Replies
So the solution is make a left join and forget those browsers feauture.? I make controll , but all my code is to same which is on guide page. But didnt work. Have somebody other solution, or find where is a bug.?
Hi @bohous you definitely don't need a manual left join. What is the $link variable in your snippet? Try to dd the result of getRelated('page')