I'm using this breadcrumb package
First, I ran this command line:
composer require davejamesmiller/laravel-breadcrumbs:5.x
I also followed these steps:
Add the service provider to providers and alias in my composer.json
:
"extra": {
"laravel": {
"laravel": {
"providers": [
"DaveJamesMiller\\Breadcrumbs\\BreadcrumbsServiceProvider"
],
"aliases": {
"Breadcrumbs": "DaveJamesMiller\\Breadcrumbs\\Facades\\Breadcrumbs"
}
}
}
},
In my routes/breadcrumbs.php
i have these codes
// Home
Breadcrumbs::for('home', function ($trail) {
$trail->push('Home', route('home'));
});
// Home > Contact Us
Breadcrumbs::for('contact-us', function ($trail) {
$trail->parent('home');
$trail->push('Contact Us', route('contact-us'));
});
// Home > About
Breadcrumbs::for('about', function ($trail) {
$trail->parent('home');
$trail->push('About', route('about'));
});
In routes/web.php
i have this
Route::get('contact-us', 'ContactUsController@ContactUs')->name('contactus');
Route::post('contact-us',[
'as'=>'contactus.store',
'uses'=>'ContactUsController@ContactUsPost'
]);
and in my contactUs.blade.php
i have this
<div class="col-md-12">
{{ Breadcrumbs::render('contactus') }}
</div>
When i go to the contact us page i see this error
Class 'Breadcrumbs' not found (View: /Applications/MAMP/htdocs/blabla/Frontend/resources/views/contactUs.blade.php)
I also tired composer update davejamesmiller/laravel-breadcrumbs
and php artisan package:discover
but still no luck
Anyone have any idea what i'm missing or doing wrong? Kind of new to Laravel, been using Yii before this. I'm using Laravel version 5.8.3
Thanks!!
Thanks to @kerbholz for the solution. Moved the code below in my composer.json
"extra": {
"laravel": {
"laravel": {
"providers": [
"DaveJamesMiller\\Breadcrumbs\\BreadcrumbsServiceProvider"
],
"aliases": {
"Breadcrumbs": "DaveJamesMiller\\Breadcrumbs\\Facades\\Breadcrumbs"
}
}
}
},
to my config/app.php
'providers' => [
.....
DaveJamesMiller\Breadcrumbs\BreadcrumbsServiceProvider::class
],
'alias' => [
.....
"Breadcrumbs" => DaveJamesMiller\Breadcrumbs\Facades\Breadcrumbs::class
]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With