1. Go to this page and download the library: Download laravel-enso/tables 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/ */
laravel-enso / tables example snippets
use Illuminate\Database\Eloquent\Builder;
use LaravelEnso\Tables\Contracts\Table;
class Users implements Table
{
public function __construct(private TableRequest $request)
{
}
public function query(): Builder
{
return User::query()->select(['id', 'email', 'is_active']);
}
public function templatePath(): string
{
return __DIR__.'/../Templates/users.json';
}
}
use Illuminate\Routing\Controller;
use LaravelEnso\Tables\Traits\Init;
use LaravelEnso\Tables\Traits\Data;
use LaravelEnso\Tables\Traits\Excel;
class InitTable extends Controller
{
use Init;
protected string $tableClass = Users::class;
}
class TableData extends Controller
{
use Data;
protected string $tableClass = Users::class;
}
class ExportExcel extends Controller
{
use Excel;
protected string $tableClass = Users::class;
}
use LaravelEnso\Tables\Contracts\CustomExportChunk;
use LaravelEnso\Tables\Contracts\Table;
class Products implements Table, CustomExportChunk
{
public function exportChunk(): int
{
return 1000;
}
}