1. Go to this page and download the library: Download edulazaro/wiretables library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
edulazaro / wiretables example snippets
use EduLazaro\Wiretables\Concerns\WithSorting;
class Projects extends Component
{
use WithPagination, WithSorting;
protected function sortable(): array
{
return ['date', 'received'];
}
public function render()
{
$column = ['date' => 'starts_on', 'received' => 'created_at'][$this->sort] ?? null;
$projects = Project::query()
->when($column, fn ($query) => $query->orderBy($column, $this->direction))
->paginate(25);
return view('livewire.projects', compact('projects'));
}
}
use EduLazaro\Wiretables\Concerns\WithLoadMore;
class Properties extends Component
{
use WithLoadMore;
protected function perLoad(): int
{
return 30;
}
public function render()
{
return view('livewire.properties', [
'properties' => $this->loadMoreFrom(Property::query()->latest()),
]);
}
}