How to use FilamentPHP Fabricator Route on custom Livewire component?
Hello,
Please let me know how do I use FilamentPHP Fabricator Page route inside custom Livewire component please ? like route('page',$page->slug)
I have a featured page block where I want to display featured pages (some of them has parent page as well) using livewire component, but I am not able to generate the route link to that page which may or may not have parent in the url.
Thank you
2 Replies
I figured it out using custom function though but I am hopeful there is a better way to do it.
function getCustomPageRoute($model)
{
$slugs = [];
if ($model->parent_id) {
$slugs[] = getCustomPageRoute($model->parent);
}
$slugs[] = $model->slug;
return implode("/", $slugs);
}
{{ url('/') . '/'. getCustomPageRoute($page)}}
You can also create shortcodes for your livewire component and add in your content block.