Skip to content

[9.x] Use route parameters in view#42461

Merged
taylorotwell merged 3 commits into
laravel:9.xfrom
yoeriboven:view-parameters
May 20, 2022
Merged

[9.x] Use route parameters in view#42461
taylorotwell merged 3 commits into
laravel:9.xfrom
yoeriboven:view-parameters

Conversation

@yoeriboven
Copy link
Copy Markdown
Contributor

@yoeriboven yoeriboven commented May 20, 2022

Route::view('route/{parameter}', 'view');

I expected $parameter to be available in the view.
There is also a test which makes it seem like it is the expected behavior.

This will actually throw an exception:

Undefined variable $parameter

This PR fixes this.

It takes all function parameters, removes the default values and adds them to the view's data.

@taylorotwell taylorotwell merged commit 7446089 into laravel:9.x May 20, 2022
@jasonmccreary
Copy link
Copy Markdown
Contributor

@taylorotwell, since this has been merged, what do we think about revisiting #40192 (this, but for implicitly bound models)?

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

Successfully merging this pull request may close these issues.

3 participants