Mounted relationship collection missing attributes

I have a mounted model with a relationship of hasMany details:

public IntroSection $introSection;
public $mountedDetails

public function mounted($id)
{
     $this->introSection = IntroSection::where('id', $id)->with(['details'])->first();
     $this->mountedDetails = $this->introSection->details;
}

dd() shows details collection complete with id, text, and timestamps


but when it hits the component view only text is available

also tried:

$this->mountedDetails = IntroSectionDetails::where('intro_section_id', $id)->get();

then toggling @entangle on $mountedDetails, both method only show text value on json

image

Are you using the latest version of Livewire: Yes and Alpinejs 2.8.1

Any idea why this is happening or is this a livewire behaviour?

When Binding Directly To Model Properties we need to pass a protected $rules variable in our livewire component class.

here is the reason why I only received text attribute on section details:

protected $rules = [
	'introSection.title' => 'string',
	'introSection.description' => 'string',
	'introSection.link' => 'string',
	'introSection.img_link' => 'string',
	'photo' => 'nullable|image|max:2000',
	'mountDetails.*.text' => 'string',
];

mountdetails only have text attribute on $rules
here is the updated code:

protected $rules = [
	'introSection.title' => 'string',
	'introSection.description' => 'string',
	'introSection.link' => 'string',
	'introSection.img_link' => 'string',
	'photo' => 'nullable|image|max:2000',
	'mountDetails.*.id' => 'numeric',
	'mountDetails.*.text' => 'string',
];

image