bohous
bohous
TCTwill CMS
Created by bohous on 5/13/2023 in #👊support
->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
MariaDB [laravel]> select * from twill_related;
+----+------------+-------------------------+------------+-----------------+--------------+----------+
| id | subject_id | subject_type | related_id | related_type | browser_name | position |
+----+------------+-------------------------+------------+-----------------+--------------+----------+
| 1 | 2 | App\Models\MenuPageLink | 7 | App\Models\Page | page | 1 |
| 2 | 3 | App\Models\MenuPageLink | 8 | App\Models\Page | page | 1 |
| 3 | 4 | App\Models\MenuPageLink | 6 | App\Models\Page | page | 1 |
MariaDB [laravel]> select * from twill_related;
+----+------------+-------------------------+------------+-----------------+--------------+----------+
| id | subject_id | subject_type | related_id | related_type | browser_name | position |
+----+------------+-------------------------+------------+-----------------+--------------+----------+
| 1 | 2 | App\Models\MenuPageLink | 7 | App\Models\Page | page | 1 |
| 2 | 3 | App\Models\MenuPageLink | 8 | App\Models\Page | page | 1 |
| 3 | 4 | App\Models\MenuPageLink | 6 | App\Models\Page | page | 1 |
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 answer
3 replies
TCTwill CMS
Created by bohous on 4/25/2023 in #👊support
dashboard route
Hello. I have a problem with dashboard config I have a Category and CategoryArticle Models I have a dashboard config in twill.php
'dashboard' => [
'modules' =>
[
'categories' =>
[
'name' => 'categories',
'label' => 'Category',
'create' => true,
'search' => true,
'count' => true,
],
'category' =>
[
'name' => 'categoryArticle',
'label' => 'Article',
'create' => true,
'search' => true,
'count' => true,
]
]
]
'dashboard' => [
'modules' =>
[
'categories' =>
[
'name' => 'categories',
'label' => 'Category',
'create' => true,
'search' => true,
'count' => true,
],
'category' =>
[
'name' => 'categoryArticle',
'label' => 'Article',
'create' => true,
'search' => true,
'count' => true,
]
]
]
With config like that id i go to dashboard I have a error
Route [twill.categoryArticle.index] not defined.
Route [twill.categoryArticle.index] not defined.
my route twill.php file
TwillRoutes::module('categories');
TwillRoutes::module('categories.articles');
TwillRoutes::module('categories');
TwillRoutes::module('categories.articles');
where I make a error.? Thx for answer
11 replies