Level 1
I found the solution, I had forgotten to add this: public $analytics_topic = null;
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi, I'm using Livewire 3. I'm struggling with sending variables to Blade. - in the below example, I get an error from Blade: "Undefined variable $analytics_topic"
For context: I'm a beginner :)
The Blade template is this:
Date is {{ $analytics_topic->conversation_date }}
The Livewire component looks like this:
<?php
namespace App\Livewire;
use Livewire\Component;
use Livewire\Attributes\On;
use App\Models\AnalyticsTopic;
class SidebarTopicDetail extends Component
{
public $topicId = null;
#[On('show-sidebar-topic-detail')] // When that event happens (on click on a topic in the frontend)
public function showSidebar($topicId)
{
// ...
$this->topicId = $topicId; // set our internal variable topicId to the one we received
$this->analytics_topic = AnalyticsTopic::find($topicId);
}
}
Please or to participate in this conversation.