Skip to content

Adds functionality for selecting the number of records in tables for the Orchid Platform.

Notifications You must be signed in to change notification settings

bald-cat/platform-per-page

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Platform Per Page

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"

About

Adds functionality for selecting the number of records in tables for the Orchid Platform.

Resources

Stars

Watchers

Forks

Packages

No packages published