-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
89 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,88 @@ | ||
## INERTIA DATATABLE | ||
## INERTIA DATATABLE | ||
|
||
<img src="./art/art.png" alt="Art" /> | ||
|
||
## RERUITMENT | ||
- php8.1 | ||
- inertiajs | ||
- laravel 8 | 9 | ||
|
||
## INSTALATION | ||
```bash | ||
composer require rizkhal/inertable | ||
``` | ||
|
||
## USAGE | ||
```bash | ||
php artisan make:inertable UserTable | ||
``` | ||
|
||
This will be generate a basic inertable starter | ||
```php | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Inertable; | ||
|
||
use Rizkhal\Inertable\Column; | ||
use Rizkhal\Inertable\Inertable; | ||
use Illuminate\Database\Eloquent\Builder; | ||
|
||
class UserTable extends Inertable | ||
{ | ||
public function query(): Builder | ||
{ | ||
// ... | ||
} | ||
|
||
public function columns(): array | ||
{ | ||
return [ | ||
// ... | ||
]; | ||
} | ||
} | ||
``` | ||
|
||
## EXAMPLE | ||
|
||
### BASIC | ||
```php | ||
<?php | ||
|
||
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::blank()->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::blank(), | ||
]; | ||
} | ||
} | ||
``` | ||
|
||
### ADVANCE | ||
... | ||
|
||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters