Skip to content

Commit

Permalink
feat: authors can be searched in the table (#965)
Browse files Browse the repository at this point in the history
  • Loading branch information
realodix committed Apr 29, 2024
1 parent 3add554 commit e3af097
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions app/Livewire/Table/AllUrlTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function datasource(): Builder
public function fields(): PowerGridFields
{
return PowerGrid::fields()
->add('user_name', function (Url $url) {
->add('author', function (Url $url) {
return '<span class="font-semibold">'.$url->author->name.'</span>';
})
->add('keyword', function (Url $url) {
Expand Down Expand Up @@ -105,7 +105,7 @@ class="btn btn-secondary btn-sm hover:text-red-600 active:text-red-700"
public function columns(): array
{
return [
Column::make('Owner', 'user_name', 'users.name')
Column::make('Owner', 'author')
->sortable()
->searchable(),

Expand All @@ -131,4 +131,11 @@ public function columns(): array
->bodyAttribute(styleAttr: ';padding-left: 8px'),
];
}

public function relationSearch(): array
{
return [
'author' => ['name'],
];
}
}

0 comments on commit e3af097

Please sign in to comment.