-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I can not send parameter to Breadcrumb #25
Comments
Hey @sametsahin. I am assuming you have your route declared as follows: Route::get('/admin/client/detail/{client}', function (Client $client) {
//code...
})->name('admin.client.detail'); Pay attention to the names that we expect (#10 (comment)) Then the breadcrumbs will look like this: Breadcrumbs::for('photos.index', fn (Trail $trail, Client $client) =>
$trail->push('...')
); |
Hello My Friend, I send client->id parameter and I call this parameter in breadcrumbs but no change. If we find solition, you will save me :) Route::get('edit/client/{id}', [ClientController::class, 'edit'])->name('edit.client');
breadcrumbs.php
Breadcrumbs::for('admin.edit.client/{id}', fn(Trail $trail, Client $client) => $trail
->parent('admin.home.client')
->push($client->id . ' Edit Client', route('admin.edit.client', $client->id))
); Link->http://127.0.0.1:8000/admin/edit/client/7 //There is not any problem about working but no show breadcrumbs Thank You |
No problem buddy. Just use the same names. Like this: Route: Route::get('edit/client/{client}', [ClientController::class, 'edit'])->name('edit.client'); Breadcrumbs: Breadcrumbs::for('edit.client', fn(Trail $trail, Client $client) => $trail
->parent('admin.home.client')
->push($client->id . ' Edit Client', route('admin.edit.client', $client->id))
); Controller: public function edit(Client $client) {
// ...
} |
Hello Buddy, Unfortunately fail again. web Breadcrumbs
Controller It seems error When i deleted "Client" in Breadcrumbs ->, fn(Trail $trail, $client_id) => $trail |
Change: public function edit($client_id){... on: public function edit(Client $client_id){... You are either working with an object. Or with a value. You cannot expect an object in one place and an integer/string in another. |
I tried buddy, When i change line url is broken. 404 not found |
Suppose the controller cannot find your model. Why should bread crumbs do this? It will help if you read https://laravel.com/docs/8.x/routing#parameters-and-dependency-injection as well as https://laravel.com/docs/8.x/routing#route-model-binding From the documentation:
|
Just do it like this;
|
i am failing in this issue too. Route::screen('integrated-accounts/{integratedAccount}', \App\Orchid\Screens\IntegratedAccountsScreen::class)->name('platform.integrated-accounts')->breadcrumbs(function (Trail $trail, \App\Models\IntegratedAccount $integratedAccount) {
return $trail
->parent('platform.index')
->push(__('Integrated Accounts'));
}); resulting : i am on orchid14 and laravel 11 |
i think this issue happens when you use 2 variables in a route and use same variable in a different route. (in the requested breadcrumb chain, 2 or greater chain needed) |
these 2 routes makes the error happen. They are parent - child in breadcrumb tree. Route::screen('integrated-accounts/{integratedAccount}/orders', \App\Orchid\Screens\IntegratedAccountOrdersScreen::class)->name('platform.integrated-account-orders')->breadcrumbs(function (Trail $trail, $integratedAccount) {
return $trail
->parent('platform.integrated-accounts',\route('platform.integrated-accounts'))
->push(__('Integrated Account Orders'));
});
Route::screen('integrated-accounts/{integratedAccount}/orders/{orderId}', \App\Orchid\Screens\IntegratedAccountOrderScreen::class)->name('platform.integrated-account-single-order')->breadcrumbs(function (Trail $trail, $integratedAccount, $orderId) {
return $trail
->parent('platform.integrated-account-orders', \route('platform.integrated-account-orders', ['integratedAccount' => $integratedAccount]))
->push(__('Integrated Account Order Detail'));
}); |
Dear All Friend,
Firstly I want to say thank you for your help.
I am using breadcrumbs in my project. There is no problem in pages where I dont send parameter. But when i want to send parameter, I dont taking anything. You can see below detail code in my project
BreadCrumbsServiceProvider
breadcrumbs.php
You think, what should I do?
The text was updated successfully, but these errors were encountered: