PHP code example of savannabits / laravel-pagetables

1. Go to this page and download the library: Download savannabits/laravel-pagetables 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/ */

    

savannabits / laravel-pagetables example snippets


use Savannabits\Pagetables\Column;
use Savannabits\Pagetables\Pagetables;
use App\Models\Article;
$columns = [
            Column::name("id")->title("ID")->sortDesc()->searchable(),
            Column::name("slug")->title("Slug")->sort()->searchable(),
            Column::name("name")->title("Name")->sort()->searchable(),
            Column::name("weighted_cost")->title("Weighted Cost")->sort()->searchable(),
            Column::name("itemGroup.name")->title("Group")->sort()->searchable(),
            Column::name("actions")->title("")->raw(true),
        ];
$dt = Pagetables::of(Article::where("enabled", "=",true))
            ->columns($columns)
            ->make(true);
return response()->json($dt);