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 Livewire support #65

Open
jamesRUS52 opened this issue Jun 8, 2023 · 3 comments
Open

Add Livewire support #65

jamesRUS52 opened this issue Jun 8, 2023 · 3 comments

Comments

@jamesRUS52
Copy link

the blade can access the public property of the livewire component without having to specify it as a parameter for "view" helper in the "render" method? like so

public $foo = 'bar';
public function render()
{
    return view('custom-livewire');
}

in blade
{{ $foo }}

Too many like this for each livewire component

Line app/Http/Requests/Requests/Livewire/View/ActionsLivewire.php


29 Variable $foo might not be defined.
29 Variable $foo might not be defined.
29 Variable $foo might not be defined.
29 Variable $foo might not be defined.
29 Variable $foo might not be defined.
29 Variable $foo might not be defined.


@AJenbo
Copy link
Contributor

AJenbo commented Jun 8, 2023

This also holds true for components, but you can workaround it by explicitly providing the variables.

public $foo = 'bar';
public function render()
{
    return view('custom-livewire', [
        'foo' => $this->foo,
    ]);
}

On that note I would also suggest that you use $this->view() rather then view() or the context will be unclear since it will be using reflection to detect and copy the properties.

@johnbacon
Copy link

Any news on whether this could be solved more elegantly with Livewire v3? 🤞

@AJenbo
Copy link
Contributor

AJenbo commented Dec 21, 2023

Is there some change that makes you think it would?

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