baldcat / platform-per-page
Adds functionality for selecting the number of records in tables for the Orchid Platform.
Installs: 24
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 0
Language:Blade
Requires
- php: ^8.0
- orchid/platform: ^14.0
Requires (Dev)
- orchestra/testbench: ^9.5
This package is auto-updated.
Last update: 2025-03-05 09:50:55 UTC
README
Installation
To install the package, run the following command:
composer require baldcat/platform-per-page
Usage
Connecting the Functionality to the Table
To add the ability to select a number of records to a table, override the $template property as shown below:
<?php namespace App\Orchid\Layouts; use Orchid\Screen\Layouts\Table; use Orchid\Screen\TD; class ExampleTable extends Table { protected $target = 'tests'; protected $template = 'platform-pp::layouts.table'; protected function columns(): iterable { return [ TD::make('id', 'ID'), ]; } }
You can use the ppp macros for the query builder to specify the number of records in the query method:
public function query(): iterable { return [ 'tests' => Test::ppp(), ]; }
Configuration
The configuration file contains two options:
<?php return [ /** * Pagination Options * * Specifies the available items per page for pagination. * Example values: * - 10: 10 items per page * - 25: 25 items per page * - 50: 50 items per page */ 'options' => [10, 25, 50], /** * Pagination Label * * The label displayed next to the pagination control. * Example: "Items Per Page". */ 'label' => 'Per Page', ];
To modify these options, publish the configuration file using the command:
php artisan vendor:publish --provider="Baldcat\PlatformPerPage\PlatformPerPageServiceProvider" --tag="config"