@wallyj never used Livewire myself, but $this->contactnotes will be an instance of Illuminate\Pagination\LengthAwarePaginator, so it's not numeric, string, array, null or boolean.
Mar 9, 2020
13
Level 3
Livewire component's public property must be of type: [numeric, string, array, null, or boolean]. Only protected or private properties can be set as other types because JavaScript doesn't need to access them.
I'm receiving the following error:
Livewire component's [contactshow] public property [contactnotes] must be of type: [numeric, string, array, null, or boolean]. Only protected or private properties can be set as other types because JavaScript doesn't need to access them.
I can't tell what I'm doing wrong. Here's my code:
Livewire Controller:
<?php
namespace App\Http\Livewire;
use Livewire\Component;
use App\Task;
class Contactshow extends Component
{
public $contacts;
public $tasktext;
public $dealId;
public $taskduedate;
public $deal_id;
public $contactnotes;
public function mount($contacts)
{
$this->contacts = $contacts;
$this->contactnotes = $this->contacts->contactnotes()->paginate();
}
public function render()
{
return view('livewire.contactshow');
}
}
Livewire Component View:
<div class="row">
<div class="col-md-12">
<ul class="list-group">
@foreach($this->contactnotes as $contactnote)
<li class="list-group-item">
{{$contactnote->created_at}} - {{$contactnote->contactnotetext}}
</li>
@endforeach
</ul>
</div>
</div>
Please or to participate in this conversation.