Skip to content
This repository has been archived by the owner on Oct 18, 2020. It is now read-only.

Let Breadcrumbs auto guess breadcrumb name #24

Merged
merged 4 commits into from
Jan 26, 2014
Merged

Let Breadcrumbs auto guess breadcrumb name #24

merged 4 commits into from
Jan 26, 2014

Conversation

Andreyco
Copy link
Contributor

No description provided.

Do not require breadcrumb name in `render()` method, guess it by the current route name instead.
@d13r
Copy link
Owner

d13r commented Jan 23, 2014

I like the idea, but I think it should be passed the route parameters too so you can use it on all pages. Do you know if that is possible?

Thanks

@Andreyco
Copy link
Contributor Author

I am afraid, I do not understand.

@d13r
Copy link
Owner

d13r commented Jan 23, 2014

So in your example of user/edit/1 it should get 1 as the second parameter. Or if model binding is used it should get the user 1 model object.

@Andreyco
Copy link
Contributor Author

Yeah, I get it... So we should find out the way how to pass User instance into Breadcrumbs registration closure.
Will think of it later tomorrow :)

@Andreyco
Copy link
Contributor Author

Okay, got it...
Now you can do this, you will get all route params passed into closure now :)

Breadcrumbs::register('test', function($breadcrumbs, $productId, $colorId){
    // $product = Product::find($productId);
    // $color = Product::find($colorId);
});

Route::get('product/{productId}/color/{colorId}', ['as' => 'test', 'uses' => function(){
    return Breadcrumbs::render();
}]);

@d13r
Copy link
Owner

d13r commented Jan 24, 2014

Looks good. I will test it over the weekend and try to get a new version released.

@Andreyco
Copy link
Contributor Author

Sweet. Works like a charm here ;)

@coveralls
Copy link

Coverage Status

Coverage remained the same when pulling e84274a on Andreyco:master into 1fa61d6 on davejamesmiller:master.

d13r added a commit that referenced this pull request Jan 26, 2014
Let Breadcrumbs auto guess breadcrumb name
@d13r d13r merged commit 68193f6 into d13r:master Jan 26, 2014
@Andreyco
Copy link
Contributor Author

Great, thanks! Now I can finally pull your package into my project! :)

@d13r
Copy link
Owner

d13r commented Jan 26, 2014

Released in 2.2.0.

@k1ng440 k1ng440 mentioned this pull request Dec 14, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants