1. Go to this page and download the library: Download mfrouh/datatable-livewire 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/ */
mfrouh / datatable-livewire example snippets
php artisan make:datatable user
php artisan make:datatable backend.user
php artisan make:datatable backend/user
namespace App\Http\Livewire\Datatables;
use MFrouh\DataTable\Datatables\Datatables;
use App\Models\User;
class User extends Datatables
{
/**
* add model
*/
public $model = User::class;
/**
* query builder
*
*/
public function queryBuilder()
{
return $this->model::query();
}
/**
* 'method_name or route()' => 'permission',
* ex 'create' => 'create post',
*
*/
public array $tablePermissions = [];
/**
* add columns in array
*
*/
public function columns(): array
{
return [];
}
/**
* add actions in array
*
*/
public function actions(): array
{
return [];
}
}