1. Go to this page and download the library: Download joe.szeto/tablelite 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/ */
joe.szeto / tablelite example snippets
\Tablelite\TablesliteServiceProvider::class
use Tablelite\Table as TableAlias;
class SomeComponent extends Component {
use \Tablelite\InteractsWithTablelite;
public function table( TableAlias $table ){
$table->schema([
TextColumn::make('id'),
TextColumn::make('name'),
])->records([
[ 'id' => 1, 'name' => 'John'],
[ 'id' => 2, 'name' => 'Doe'],
]);
}
}
$table->schema([
TextColumn::make('id'),
TextColumn::make('name'),
])
->records(
function ($page) {
// fetch api here
}
)
->paginateUsing(
function ($records, PaginatorBuilder $builder) {
// records is the response of the fetching
return $builder
->items($records['data']) // the items
->total($records['total']) // total items
->perPage($records['per_page'])
->currentPage($records['current_page']);
}
);
composer
app.php
bladehtml
<div>
{{ $this->getTable() }}
</div>
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.