this package manage livewire components to show set of item and handle quering of database
aristonis/laravel-livewire-dataview is a Laravel package for this package manage livewire components to show set of item and handle quering of database.
It currently has 0 GitHub stars and 0 downloads on Packagist (latest version 0.1.0).
Install it with composer require aristonis/laravel-livewire-dataview.
Discover more Laravel packages by aristonis
or browse all Laravel packages to compare alternatives.
Last updated
Laravel Livewire Dataview is a developer-focused toolkit for building SOLID-friendly data listing experiences in Livewire 3. It standardises how you configure queries, pagination and row rendering while keeping your components expressive and testable.
see docs
DataViewComponent) that centralises pagination, queries and rendering.dataview:make artisan command to scaffold a DataView component plus optional item component and Blade view.config/dataview.php) and reusable stubs for custom scaffolding.composer require aristonis/laravel-livewire-dataview
Optionally publish the package assets:
php artisan vendor:publish --tag=dataview-views # copues views component and customize it
php artisan vendor:publish --tag=dataview-config # copies config/dataview.php
php artisan vendor:publish --tag=dataview-stubs # copies stub templates
Scaffold a dataview plus item component:
php artisan dataview:make Users/UserTable --with-item
Edit the generated component so it extends Aristonis\LaravelLivewireDataview\DataViewComponent and configure the query, pagination and item view:
<?php
namespace App\Livewire\Users;
use App\Models\User;
use Aristonis\LaravelLivewireDataview\DataViewComponent;
class UserTable extends DataViewComponent
{
protected function configure(): void
{
$this->setItemView('users.user-table-item');
$this->setPerPage(20);
}
protected function query()
{
return User::query()->with('roles')->orderByDesc('created_at');
}
}
The generated Blade view (resources/views/livewire/users/user-table-item.blade.php) receives each item through the item prop. You can customise the markup as you see fit.
Render the dataview in any Blade template:
<livewire:users.user-table />
The default package view (aristonis-dataview::livewire.dataview) loops through your collection and renders the configured item component with stable Livewire keys, then shows pagination links when the query returns a paginator.
config/dataview.php controls the base behaviour:
pagination.per_page: global default for $this->getPerPage().pagination.enable: you can toggle pagination at runtime with enablePagination() / disablePagination().item.keyName: used when generating Livewire keys; override via $this->setKeyName('uuid').Every component can override these defaults inside configure() to keep component logic predictable and SOLID.
composer test
The test suite relies on Orchestra Testbench. Please ensure new functionality is accompanied by unit or feature coverage.
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details on our workflow and coding standards.
The MIT License (MIT). Please see LICENSE for more information.