11
11
12
12
A simple Laravel-style way to create breadcrumbs.
13
13
14
- This project is the [ official fork] ( https://newsroom.diglactic.com/laravel-breadcrumbs/ ) of the fantastically original
15
- [ Laravel Breadcrumbs by Dave James Miller] ( https://github.com/davejamesmiller/laravel-breadcrumbs ) and wouldn't have
16
- been possible without
17
- [ a bunch of awesome day-one contributors] ( https://github.com/davejamesmiller/laravel-breadcrumbs/graphs/contributors ) .
14
+ This project is the official fork of the fantastically
15
+ original [ Laravel Breadcrumbs by Dave James Miller] ( https://github.com/davejamesmiller/laravel-breadcrumbs ) and wouldn't
16
+ have been possible
17
+ without [ a bunch of awesome day-one contributors] ( https://github.com/davejamesmiller/laravel-breadcrumbs/graphs/contributors ) .
18
18
Thanks, all!
19
19
20
20
@@ -39,9 +39,10 @@ Compatibility Chart
39
39
40
40
| Laravel | Laravel Breadcrumbs |
41
41
| ---------| ---------------------|
42
- | 10.x | 8.x |
43
- | 9.x | 8.x |
44
- | 8.x | 8.x |
42
+ | 11.x | 9.x |
43
+ | 10.x | 9.x |
44
+ | 9.x | 9.x |
45
+ | 8.x | 9.x |
45
46
| 7.x | 8.x |
46
47
| 6.x | 8.x |
47
48
@@ -117,7 +118,7 @@ The possible values are:
117
118
- ` breadcrumbs::bootstrap4 ` – [ Bootstrap 4] ( https://getbootstrap.com/docs/4.0/components/breadcrumb/ )
118
119
- ` breadcrumbs::bulma ` – [ Bulma] ( https://bulma.io/documentation/components/breadcrumb/ )
119
120
- ` breadcrumbs::foundation6 ` – [ Foundation 6] ( https://get.foundation/sites/docs/breadcrumbs.html )
120
- - ` breadcrumbs::json-ld ` – [ JSON-LD Structured Data] ( https://developers.google.com/search/docs/data-types/breadcrumbs )
121
+ - ` breadcrumbs::json-ld ` – [ JSON-LD Structured Data] ( https://developers.google.com/search/docs/appearance/structured-data/breadcrumb )
121
122
- ` breadcrumbs::materialize ` – [ Materialize] ( https://materializecss.com/breadcrumbs.html )
122
123
- ` breadcrumbs::tailwind ` – [ Tailwind CSS] ( https://tailwindcss.com/ )
123
124
- ` breadcrumbs::uikit ` – [ UIkit] ( https://getuikit.com/docs/breadcrumb )
@@ -141,8 +142,8 @@ parameters:
141
142
{{ Breadcrumbs::render('category', $category) }}
142
143
```
143
144
144
- See the [ Outputting Breadcrumbs] ( #outputting-breadcrumbs ) section for other output options, and see
145
- [ Route-Bound Breadcrumbs] ( #route-bound-breadcrumbs ) for a way to link breadcrumb names to route names automatically.
145
+ See the [ Outputting Breadcrumbs] ( #outputting-breadcrumbs ) section for other output options, and
146
+ see [ Route-Bound Breadcrumbs] ( #route-bound-breadcrumbs ) for a way to link breadcrumb names to route names automatically.
146
147
147
148
148
149
Defining Breadcrumbs
@@ -236,8 +237,9 @@ Breadcrumbs::for('post', function (BreadcrumbTrail $trail, Post $post) {
236
237
});
237
238
```
238
239
239
- The ` $post ` object (probably an Eloquent [ Model] ( https://laravel.com/api/10.x/Illuminate/Database/Eloquent/Model.html ) ,
240
- but could be anything) would be passed in from the view:
240
+ The ` $post ` object (probably an
241
+ Eloquent [ Model] ( https://laravel.com/api/master/Illuminate/Database/Eloquent/Model.html ) , but could be anything) would
242
+ be passed in from the view:
241
243
242
244
``` blade
243
245
{{ Breadcrumbs::render('post', $post) }}
@@ -348,7 +350,7 @@ you to make edits directly.
348
350
349
351
#### View data
350
352
351
- The view will receive a [ Collection] ( https://laravel.com/api/10.x /Illuminate/Support/Collection.html )
353
+ The view will receive a [ Collection] ( https://laravel.com/api/master /Illuminate/Support/Collection.html )
352
354
called ` $breadcrumbs ` .
353
355
354
356
Each breadcrumb is an [ object] ( https://www.php.net/manual/en/language.types.object.php ) with the following keys:
@@ -399,7 +401,8 @@ Or with a parameter:
399
401
Structured Data
400
402
---------------
401
403
402
- To render breadcrumbs as JSON-LD [ structured data] ( https://developers.google.com/search/docs/data-types/breadcrumbs )
404
+ To render breadcrumbs as
405
+ JSON-LD [ structured data] ( httpshttps://developers.google.com/search/docs/appearance/structured-data/breadcrumb )
403
406
(usually for SEO reasons), use ` Breadcrumbs::view() ` to render the ` breadcrumbs::json-ld ` template in addition to the
404
407
normal one. For example:
405
408
@@ -460,7 +463,7 @@ Route::name('home')->get('/', 'HomeController@index');
460
463
Route::name('post')->get('/post/{id}', 'PostController@show');
461
464
```
462
465
463
- For more details, see [ Named Routes] ( https://laravel.com/docs/10.x/ routing#named-routes ) in the Laravel documentation.
466
+ For more details, see [ Named Routes] ( https://laravel.com/docs/routing#named-routes ) in the Laravel documentation.
464
467
465
468
### Name your breadcrumbs to match
466
469
@@ -485,8 +488,8 @@ Breadcrumbs::for('post', function (BreadcrumbTrail $trail, Post $post) {
485
488
});
486
489
```
487
490
488
- To add breadcrumbs to a [ custom 404 Not Found page] ( https://laravel.com/docs/10.x/ errors#custom-http-error-pages ) , use
489
- the name ` errors.404 ` :
491
+ To add breadcrumbs to a [ custom 404 Not Found page] ( https://laravel.com/docs/errors#custom-http-error-pages ) , use the
492
+ name ` errors.404 ` :
490
493
491
494
``` php
492
495
Breadcrumbs::for('errors.404', function (BreadcrumbTrail $trail) {
@@ -576,7 +579,7 @@ Breadcrumbs::for('post', function (BreadcrumbTrail $trail, Post $post) { // <--
576
579
577
580
This makes your code less verbose and more efficient by only loading the post from the database once.
578
581
579
- For more details see [ Route Model Binding] ( https://laravel.com/docs/10.x/ routing#route-model-binding ) in the Laravel
582
+ For more details see [ Route Model Binding] ( https://laravel.com/docs/routing#route-model-binding ) in the Laravel
580
583
documentation.
581
584
582
585
### Resourceful controllers
@@ -641,7 +644,7 @@ Breadcrumbs::for('photo.edit', function (BreadcrumbTrail $trail, Photo $photo) {
641
644
});
642
645
```
643
646
644
- For more details see [ Resource Controllers] ( https://laravel.com/docs/10.x/ controllers#resource-controllers ) in the
647
+ For more details see [ Resource Controllers] ( https://laravel.com/docs/controllers#resource-controllers ) in the
645
648
Laravel documentation.
646
649
647
650
(Related FAQ: [ Why is there no Breadcrumbs::resource() method?] ( #why-is-there-no-breadcrumbsresource-method ) .)
@@ -742,7 +745,7 @@ Breadcrumbs::after(function (BreadcrumbTrail $trail) {
742
745
```
743
746
744
747
For more advanced filtering, use ` Breadcrumbs::generate() ` and Laravel's
745
- [ Collection class] ( https://laravel.com/api/10.x /Illuminate/Support/Collection.html ) methods instead:
748
+ [ Collection class] ( https://laravel.com/api/master /Illuminate/Support/Collection.html ) methods instead:
746
749
747
750
``` php
748
751
<?php
@@ -754,8 +757,8 @@ $current = Breadcrumbs::generate()->where('current', '!==', false)->last();
754
757
755
758
### Switching views at runtime
756
759
757
- You can use ` Breadcrumbs::view() ` in place of ` Breadcrumbs::render() ` to render a template other than the
758
- [ default one] ( #3-style ) :
760
+ You can use ` Breadcrumbs::view() ` in place of ` Breadcrumbs::render() ` to render a template other than
761
+ the [ default one] ( #3-style ) :
759
762
760
763
``` blade
761
764
{{ Breadcrumbs::view('partials.breadcrumbs2', 'category', $category) }}
@@ -846,7 +849,7 @@ class MyServiceProvider extends ServiceProvider
846
849
847
850
### Dependency injection
848
851
849
- You can use [ dependency injection] ( https://laravel.com/docs/10.x/ providers#the-boot-method ) to access the ` Manager `
852
+ You can use [ dependency injection] ( https://laravel.com/docs/providers#the-boot-method ) to access the ` Manager `
850
853
instance if you prefer, instead of using the ` Breadcrumbs:: ` facade:
851
854
852
855
``` php
@@ -866,9 +869,8 @@ class MyServiceProvider extends ServiceProvider
866
869
867
870
### Macros
868
871
869
- The breadcrumbs ` Manager ` class is
870
- [ macroable] ( https://unnikked.ga/understanding-the-laravel-macroable-trait-dab051f09172 ) , so you can add your own
871
- methods. For example:
872
+ The breadcrumbs ` Manager ` class is [ macroable] ( https://tighten.com/insights/the-magic-of-laravel-macros/ ) , so you can
873
+ add your own methods. For example:
872
874
873
875
``` php
874
876
<?php
912
914
### Why is there no ` Breadcrumbs::resource() ` method?
913
915
914
916
A few people have suggested adding ` Breadcrumbs::resource() ` to match
915
- [ ` Route::resource() ` ] ( https://laravel.com/docs/10.x/ controllers#resource-controllers ) , but no one has come up with a
917
+ [ ` Route::resource() ` ] ( https://laravel.com/docs/controllers#resource-controllers ) , but no one has come up with a
916
918
good implementation that a) is flexible enough to deal with translations, nested resources, etc., and b) isn't overly
917
919
complex as a result.
918
920
@@ -1104,6 +1106,7 @@ The following files will need to be updated to run tests against a new Laravel v
1104
1106
- [ ` composer.json ` ] ( composer.json )
1105
1107
- ` laravel/framework ` (Laravel versions)
1106
1108
- ` php ` (minimum PHP version)
1109
+ - Other dependencies (prefer bumping to the highest-available versions that work for all Laravel/PHP combinations)
1107
1110
1108
1111
- [ ` tests.yml ` ] ( .github/workflows/tests.yml )
1109
1112
- ` jobs.phpunit.strategy.matrix.laravel ` (Laravel versions)
@@ -1114,7 +1117,6 @@ And the following documentation, as needed:
1114
1117
1115
1118
- [ ` README.md ` ] ( README.md )
1116
1119
- [ Compatibility Chart] ( #compatibility-chart )
1117
- - All links to ` https://laravel.com/docs/* ` and ` https://laravel.com/api/* `
1118
1120
1119
1121
- [ ` UPGRADE.md ` ] ( UPGRADE.md )
1120
1122
- Add new section detailing any breaking package changes
0 commit comments