diglactic / laravel-breadcrumbs

Laravel Breadcrumbs - A simple Laravel-style way to create breadcrumbs.
https://packagist.org/packages/diglactic/laravel-breadcrumbs
MIT License
868 stars 63 forks source link

How to split the breadcrumbs.php file across multiple files? #45

Closed kerrinhardy closed 2 years ago

kerrinhardy commented 2 years ago

In my application there are a number of pages for each model (the standard CRUD pages, plus additional views and reports). Before it becomes too unwieldily, I was looking to split it up into multiple files - all called from breadcrumbs.php.

A simple require / include statement is not working (in a Laravel project)?

Has anyone done this before?

shengslogar commented 2 years ago

I don’t think I’ve personally ever used includes (I would instead break things out into multiple classes with a single static method like PostBreadcrumbs::register() that can be called from the root breadcrumbs file using namespaced imports) but I don’t know of any reason why an include wouldn’t work. Is there a specific error you’re getting when you try this?

kerrinhardy commented 2 years ago

Thanks for the update. I started going down that path, and then looking at the config file I see there is an option to use a wildcard: 'files' => glob(base_path('breadcrumbs/*.php')),

Turns out it was easy to do. Thank you for a great plugin!