Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

dryant's avatar

[Solved] Send parameter to a livewire component controller

Hi everyone!

I have a Post Model, and I need navigate in my app admin control panel, for all specific user posts. I have a livewire component called PostsList and I'm trying to send a $post variable to use this varibale to determine which user belongs to.

My livewire component is like this:

use Livewire\Component;
use App\Models\Post;
use App\Models\User;

class Edit extends Component
{
    public $post;
    public function render()
    {
		//this dump get an 'Undefined variable $post' error
        dump($post);

		//I need get the post user:
		$user = $post->user;
        return view('livewire.admin.articles.edit', compact('user','article'));
    }
}

And I'm calling the livewire component like this:

//This dump show the post model perfect
@dump($post)
@livewire('admin.posts.edit', ['post' => $post])

However, whith dump($post) in the controller, I get an Undefined variable $post error...

How I can send the $post variable to the livewire component Controller?

0 likes
4 replies
OussamaMater's avatar
Level 37

Change $post to $this->post that should do it.

2 likes
Snapey's avatar

is user not the authenticated user?

1 like

Please or to participate in this conversation.