This is the most important part of this boilerplate. We can generate datatable with search, filter, with server side pagination very easily with Laravel premio. Just follow the below steps:

Fetching data from controller

Assume we are going to fecth Page model data.

public function index(Request $request)
    if ($request->ajax()) {
        return $this->table(Page::query())
            ->addColumn('action', function ($row) {
                return action_button([
                    'first_link' => [
                        'route' => route('page.edit',$row->slug),
                        'is_modal' => false, //page open without modal
                        'button_text' => 'Edit'
                    'second_link' => [
                        'route' => route('page.delete',$row->slug),
                        'true' => false, //page open with modal
                        'button_text' => 'Trash'
            ->editColumn('name', function($row){ 
                if($row->status == true){
                    return $row->name . " <span class='text-primary'>(Published)</span>";
                    return $row->name ." <span class='text-info'>(Draft)</span>";
            ->escapeColumns('name') //if you use `HTML` like `name` column, you need to scape using `escapeColumns`

    return view('');

Now generate datatable in your page index page like this

    < data="Pages" />
    <x-slot name="style">
        <link rel="stylesheet" href="{{ mix('css/datatable.css') }}" />
    <x-slot name="content">
        <div class="card">
            <div class="card-body">
                //the column you want to show
                {{ generate_table_columns(['name', 'created', 'last modified', 'action']) }} 
        @include('admin.modal._export', ['db_table' => 'pages']) //pass table name to export it
    <x-slot name="script">
        <script src="{{ mix('js/datatable.js') }}"></script>
            const columns = ['id', 'name', 'created_at', 'updated_at']; //the exact column name you want to display
            const order = "desc"; //you can pass order by 'desc' and 'asc'
            const route = "{{ route('page.index') }}"; //route
            const button = true; //if you pass false then action button does not show.
            const table = 'Page'; //Model name
            generate_datatable(route, columns, order, button, table);