Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: authors can be searched in the table #965

Merged
merged 1 commit into from
Apr 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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'],
];
}
}