Is $message an Eloquent model; are you using Livewire v2?
Try typehinting it in the public properties as
public Message $message;
public function mount(Message $message)
{
$this->message = $message;
}
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I am getting this issue, and I don't understand what I am doing wrong as I did this same exact approach for another component on this site, and works perfectly....

ViewMessages.php
public $messages;
public function mount($messages)
{
$this->messages = $messages;
}
view-messages.blade.php
<div class="flex flex-col">
@foreach ($messages as $message)
{{$message->content}}
@endforeach
</div>
Everything works and it outputs all the messages correctly.
When I try and pass in a livewire component into the for each, it gives that error.
@foreach ($messages as $message)
@livewire('chat.show-message', ['message'=>$message], key('show-message-'.$message->id))
@endforeach
// ShowMessage.php
public $user;
public $message;
public $user_id;
public $content;
public function mount($message)
{
$this->message = $message;
}
Honestly am lost on what I am doing wrong, as I copied the exact same code and changed the variables that I used before. It works right now on the site when I do nested components.
<div class="flex flex-col space-y-4 py-4 overflow-y-auto">
@foreach ($chats as $chat)
@livewire('kanbans.show-sidebar-chat-message', ['chat'=>$chat], key('chat-'.$chat->id))
@endforeach
</div>
I redid this component already twice, and can't find any syntax issues or spelling errors. =/
Please or to participate in this conversation.