mjanssen / Laravel-5-breadcrumbs-bundle

A simple solution for breadcrumbs in Laravel 5+
15 stars 7 forks source link

In Admin, the link home redirect to root site. #15

Open multiarts opened 8 years ago

multiarts commented 8 years ago

In the case also use the admin, but the Home link for example the route always goes to example.com and not to example.com/admin. How to solve this?

mjanssen commented 8 years ago

Home (the first breadcrumb) refers to the base-url (example.com). The second breadcrumb would be "Admin" in this example. Which would refer to example.com/admin.

Could you please explain your question a bit more and/or provide some code? Are you using Breadcrumbs::automatic();?

multiarts commented 8 years ago

Yes, I'm using Breadcrumbs::automatic() for both front and admin.

mjanssen commented 8 years ago

What would you like to do with the breadcrumbs?

multiarts commented 8 years ago

That the admin home redirect to the admin. From: Home / Category / Music and not Home / Admin / Category / Music

mjanssen commented 8 years ago

The Breadcrumbs::automatic(); builds the breadcrumbs by the current URL. So if your url is example.com/admin/category/music, your breadcrumbs will be Home (example.com) / admin (example.com/admin) / category (example.com/admin/category) / music (example.com/admin/category/music).

If you want to build the breadcrumbs in a different order (or leaving out / adding one), I suggest building the breadcrumbs within your constructor or function which is called.

mjanssen commented 8 years ago

I could update the package so you'll be able to set a base-url, if you want to.

multiarts commented 8 years ago

ok, would be great and thank you for your time and attention, I will study more code and contribute.

Att, John Mello

mjanssen commented 8 years ago

You can update your local package to the latest one (composer update). This version contains an option to set the set the home url base (Breadcrumbs::setHomeUrlBase("admin");). Remember to set the base before generating the breadcrumbs.