Skip to content
This repository was archived by the owner on Feb 15, 2024. It is now read-only.

Latest commit

 

History

History
38 lines (29 loc) · 972 Bytes

creating-components.md

File metadata and controls

38 lines (29 loc) · 972 Bytes
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.