Closed philipbaginski closed 2 years ago
It's built as a card because its the easiest way to add something to the top of all of the required pages.
Sure I could have wrapped the pages again in the style of my Resource Cards package and used a Tool or some such to add the Breadcrumbs to every page, but as I had already wrapped the pages for my resource cards this seemed like over-engineering.
Theres nothing stopping you from overriding resolveCards
on your App/Nova/Resource.php
file which all of your Resources extend by default and doing the following:
public function resolveCards(NovaRequest $request)
{
$cards = $this->cards($request);
array_unshift($cards, Breadcrumbs::make($request, $this));
return collect(array_values($this->filter($cards)));
}
Thanx for comment. It makes sense. I will try to apply b. for all resources following your tip.
I've just tested it on my end and it seems to work fine.
Ran into a reflection throwable issue in the process of testing it, might not have caught it for a while if I wasn't testing this, so thanks! Fixes are in 0.1.2
Updated the documentation to suggest this method for applying it globally.
:-) I had the same. Implementing breadcrumbs to one of the resource shows me the issue I was not going to discover without it. Thanks 🙏
Awesome, closing this for now but if you need anything else feel free to open a new issue (or just reply here again if its related)
Hi!
It's not an issue, but I could not create request.
My question: Why we can not add breadcrumbs globally in Resource file, or Nova Service Provider file as a tool?
If we have plenty of resources and in any future this package will have any kind of not compatibility with any part of Nova, it will be very painful to remove code from all resources. Normally, commonly breadcrumbs are for all pages in the app, not only selected.
It is my point of view of course and fell free to give any kind of feedback to this question :-)