title | weight |
---|---|
Creating Components |
1 |
You can create components by using the command or copying from one of the examples.
This is what a bare bones component looks like before your customization:
<?php
namespace App\Http\Livewire;
use App\Models\User;
use Rappasoft\LaravelLivewireTables\DataTableComponent;
use Rappasoft\LaravelLivewireTables\Views\Column;
class UsersTable extends DataTableComponent
{
protected $model = User::class;
public function configure(): void
{
$this->setPrimaryKey('id')
}
public function columns(): array
{
Column::make('ID', 'id')
->sortable(),
Column::make('Name')
->sortable(),
}
}
Your component will extend the Rappasoft\LaravelLivewireTables\DataTableComponent
class and at minimum implement 2 methods called configure and columns.