What seems to be the problem:
I am currently going the laracast tutorial to build a data-table with livewire. E. g. implementing a dynamic paggination is not working. If I select the pagination from 10 to 15 on the GUI nothing happend.
I am using Laravel 7.5.2 for my project with livewire 1.0.
My steps:
- Installation require livewire/livewire
- Added
<livewire:styles>
at End of my Header and<livewire:scripts>
at the end of Body of main main layout blade file. Livewire doc explains to use those tags from laravel 7 and higher on. - Created the view countries-table.blade.php. This is how the pagination looks like:
<div class="col form-inline">
{{__('Rows per Page')}}
<select wire.model="perPage" class="form-control">
<option>10</option>
<option>15</option>
<option>25</option>
</select>
</div>
- Created the livewire file CountriesTable.php:
<?php
namespace App\Http\Livewire;
use Livewire\Component;
use Livewire\WithPagination;
class CountriesTable extends Component
{
use WithPagination;
public $perPage = 10;
public function render()
{
//return view('livewire.countries-table');
return view('livewire.countries-table', [
'countries' => \App\Country::paginate($this->perPage),
]);
}
}
- Including the livewire blade from #3 in my index.blade.php of countries with the following code:
@include('livewire.countries-table')
Looks like I forgot or missed something really big. But I just can’t figure it out.