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

allow page composition through Route::livewire #157

Open
wants to merge 1 commit into
base: master
from

Conversation

@faustbrian
Copy link
Contributor

commented Aug 12, 2019

1️⃣ Is this something that is wanted/needed? Did you create a feature-request issue first?
Probably. No.

2️⃣ Does it contain multiple, unrelated changes? Please separate the PRs out.
No

3️⃣ Does it include tests if possible? (Not a deal-breaker, just a nice-to-have)
Yes

4️⃣ Please include a thorough description of the feature/fix and reasons why it's useful.
I find myself quite frequently in a situation where I end up composing pages with multiple components that are just a list of chained @livewire(...) calls in a blade template. This PR allows to pass in components as either a string or an array and will loop over them to include them.

Old

@extends('layouts.dashboard')

@section('content')
    @livewire('update-contact-information')

    @livewire('update-profile-information')
@endsection

New

Route::livewire('profile', [
    'update-contact-information',
    'update-profile-information',
])->name('settings.profile');

This new syntax makes it very easy to compose pages that consist purely of Livewire components without the need of having an extra blade template for it.

5️⃣ Thanks for contributing! 🙌

@faustbrian faustbrian force-pushed the faustbrian:feat/page-composition branch from 2f21032 to 4c475b5 Aug 12, 2019

@faustbrian faustbrian force-pushed the faustbrian:feat/page-composition branch from d10a212 to 4554501 Aug 12, 2019

@lancepioch

This comment has been minimized.

Copy link

commented Aug 12, 2019

This looks super cool, two side questions:

  1. Does route caching still work?
  2. Is there a method for the @extends?
@faustbrian

This comment has been minimized.

Copy link
Contributor Author

commented Aug 13, 2019

  1. Seems to still work fine as only the composition of the view changed.
  2. Not sure what you mean. You can use the layout method or route group property to change that property if that is what you mean. https://livewire-framework.com/docs/spa-mode/
@calebporzio

This comment has been minimized.

Copy link
Owner

commented Aug 15, 2019

This is interesting, I'm not sure how I feel about it though.

Does anyone else find this useful? (in real life, not just in theory)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.