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

Add inertia() helper function #36

Merged
merged 1 commit into from Aug 8, 2019
Merged

Conversation

georgehanson
Copy link
Contributor

@reinink This is a re-open on my previous PR #29.


When using the Laravel framework I personally find it cleaner to use the view(), so I'd also really like to be able to use the same approach with Intertia.

This pull request simply adds a helper function inertia().

For example:

return Intertia::render('Welcome', ['name' => 'George']);

becomes

return inertia('Welcome', ['name' => 'George']);

You can also access the ResponseFactory instance by not passing any parameters to the function. This allows you to make calls to other methods such as share.

inertia()->share('name', 'George');

@reinink reinink merged commit 31de346 into inertiajs:master Aug 8, 2019
@reinink
Copy link
Member

reinink commented Aug 8, 2019

Dig it, thanks @georgehanson.

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.

None yet

2 participants