Event extends to liveware component
This is my event code
class InboundMessageProcessed extends Component
{
use Dispatchable, SerializesModels; public $processedData; public function __construct($processedData) { Log::info($processedData); $this->emit("messageAdded");
}
My error is "message": "Access level to Illuminate\Queue\SerializesModels::getPropertyValue() must be public (as in class Livewire\Component)", "exception": "Symfony\Component\ErrorHandler\Error\FatalError", "file": "/home/satyajitsahoo/Documents/Live Project/chat/multifamily-mindset-monorepo/vendor/laravel/framework/src/Illuminate/Queue/SerializesModels.php", "line": 104, "trace": [] }
use Dispatchable, SerializesModels; public $processedData; public function __construct($processedData) { Log::info($processedData); $this->emit("messageAdded");
}
My error is "message": "Access level to Illuminate\Queue\SerializesModels::getPropertyValue() must be public (as in class Livewire\Component)", "exception": "Symfony\Component\ErrorHandler\Error\FatalError", "file": "/home/satyajitsahoo/Documents/Live Project/chat/multifamily-mindset-monorepo/vendor/laravel/framework/src/Illuminate/Queue/SerializesModels.php", "line": 104, "trace": [] }
3 Replies
The SerializesModels trait has a method with the same name, getPropertyValue, as the Livewire Component class, so they are clashing.
Are you actually using the SerializesmModels trait?
no i want a data pass event to liveware when event dispach
can you give any example or any documentation for reference
Afaik, you can't just directly listen for Laravel events in Livewire. I think you'd have to use Echo to broadcast from your Laravel event handler, then listen for that in your Livewire component. This is documented in both Livewire v2 and v3 docs:
https://laravel-livewire.com/docs/2.x/laravel-echo
https://livewire.laravel.com/docs/events#real-time-events-using-laravel-echo
Livewire
Laravel Echo | Livewire
A full-stack framework for Laravel that takes the pain out of building dynamic UIs.
Laravel
Events | Laravel
A full-stack framework for Laravel that takes the pain out of building dynamic UIs.