Skip to content
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

Argument 2 passed to {closure}() must be an instance of #10

Open
akshay13aac opened this issue Sep 5, 2020 · 2 comments
Open

Argument 2 passed to {closure}() must be an instance of #10

akshay13aac opened this issue Sep 5, 2020 · 2 comments

Comments

@akshay13aac
Copy link

closure://function (\Tabuna\Breadcrumbs\Trail $trail, \App\Models\Backend\Chamber $chamber) { $trail->parent('admin.chambers.index') ->push(__('Editing :chamber', ['chamber' => $chamber->id]), route('admin.chambers.edit', $chamber)); }:2

@akshay13aac akshay13aac changed the title Argument 2 passed Argument 2 passed to {closure}() must be an instance of Sep 5, 2020
@DeBelserArne
Copy link

DeBelserArne commented Oct 25, 2020

Have u imported use Tabuna\Breadcrumbs\Trail; ?

@octoquad
Copy link

I had this problem as well. For the route URI you need to set the parameter to match the second argument of the breadcrumbs function:

Route::get('admin/chambers/{chamber}', ...)

instead of

Route::get('admin/chambers/{id}', ....)

This will inject the value (in this case, the ID of the record to load) into the Chamber class and instantiate a new model (route model binding).

The full error is

Argument 2 passed to {closure}() must be an instance of App\Models\Chamber, string given

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants