-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSortableTable.php
43 lines (36 loc) · 1014 Bytes
/
SortableTable.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
namespace App\Livewire;
use Illuminate\Contracts\Foundation\Application;
use Illuminate\Contracts\View\Factory;
use Illuminate\Contracts\View\View;
use Livewire\Component;
class SortableTable extends Component
{
/**
* @var SortableTableColumn[]
*/
private array $columns = [];
/**
* @var object[]
*/
private array $rows = [];
private string $extraRowLivewire = '';
/**
* @param SortableTableColumn[] $columns
* @param object[] $rows
*/
public function mount(array $columns = [], array $rows = [], string $extraRowLivewire = ''): void
{
$this->rows = $rows;
$this->columns = $columns;
$this->extraRowLivewire = $extraRowLivewire;
}
public function render(): Factory|View|Application
{
return view('livewire.sortable-table')->with([
'rows' => $this->rows,
'columns' => $this->columns,
'extraRowLivewire' => $this->extraRowLivewire,
]);
}
}