-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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 params method to view macros #2736
Conversation
@rezaamini-ir nice PR, I definitely think this is something that would be useful! The only thing I would consider changing is the name. To me reading There was an existing PR #2315 which did a similar thing but was closed. @calebporzio the reason I think the original PR and this one would be of benefit is, so you don't need to specify the layout name each time, which you would if you are using the Especially if you are using default app layout as you don't need to use Hope this helps! |
@joshhanley Yes you are right about the name and use cases. |
I've also encountered this. What I found is that you can pass That being said, I do feel like a dedicated method without having to specify the layout does make sense. In my own project I created a macro |
@zepfietje I'm agree with |
I could be down with this. Thanks for the input everyone. I prefer layoutParams though to stay consistent. Would you be able to PR this to the docs as well? |
@calebporzio wouldn't |
Interesting, what are the references to Laravel core? |
The Laravel docs mention passing data to views: https://laravel.com/docs/8.x/views#passing-data-to-views. I couldn't find any references where it's being referred to as params. Also, internally it's named |
@calebporzio So are agree to change the method name to Also, I will update docs for these changes if these changes are merged. |
Yep! I dig! |
@calebporzio I think this hadn't been updated yet, so |
@joshhanley Yes you are right. |
Ooops, adjusted now. Thanks! |
Not sure if changes are still being considered. I see that Second test is passing because it checks for |
Thanks! |
In some cases we just need to pass some data like the title to the base layout and now to do that in Livewire we have to use
layout
method then pass the params as the second param like this :With these changes, we will be able to use a syntax like this:
Also, all tests have been passed and new tests have been written!