A Livewire presenter component
Installation
You can install the package via composer:
composer require foxws/livewire-presenter
You can publish the config file with:
php artisan vendor:publish --tag="livewire-presenter"
Usage
<?php
use Foxws\Presenter\Fields\Field;
use Foxws\Presenter\Presenter;
use Foxws\Presenter\Filters\Filter;
use Illuminate\Pagination\LengthAwarePaginator;
use Illuminate\View\View;
class UserOverviewController extends Presenter
{
public function mount()
{
//
}
public function render(): View
{
return view('users.overview')
->layout('layouts.app');
}
protected function builder(): LengthAwarePaginator
{
return User::all()
->paginate(perPage: $this->perPage);
}
protected function configure(): void
{
//
}
protected function fields(): array
{
return [
Field::new()
->name('name')
->label(__('Name'))
->component('users.presenter.name')
->sortable(),
Field::new()
->name('email')
->label(__('Email'))
->component('users.presenter.email'),
];
}
protected function filters(): array
{
return [
Filter::new()
->name('created_at')
->label(__('Created At'))
->value(now()->subDays(90)),
];
}
}
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.