1. Go to this page and download the library: Download rizkhal/inertable 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/ */
rizkhal / inertable example snippets
declare(strict_types=1);
namespace App\Inertable;
use App\Models\User;
use Rizkhal\Inertable\Column;
use Illuminate\Support\Carbon;
use Rizkhal\Inertable\Inertable;
use Illuminate\Database\Eloquent\Builder;
class UserTable extends Inertable
{
public function query(): Builder
{
return User::query();
}
public function columns(): array
{
return [
Column::checkbox(),
Column::make(__('Name'), 'name')->sortable()->searchable(),
Column::make(__('Email'), 'email')->sortable()->searchable(),
Column::make(__('Verified'), 'email_verified_at')->sortable()->searchable()->format(fn (Carbon $value): string => $value->format('d/m/Y')),
Column::make(__('status'), 'status')->sortable()->searchable(),
Column::action(),
];
}
}
protected $hiddens = [
'office'
];
protected $hiddens = [
'user.posts'
];
public function __invoke() {
return inertia('/path/to/file.{vue|jsx|svelte}')->inertable(new UserTable());
}
bash
php artisan make:inertable UserTable
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.