F
Filament2mo ago
Ibakha

Get Table Record in Livewire Component

Hi, I'm using a filament table in a livewire component. I'm trying to use a record of the table to pass an argument to a view, but my record is always returning the livewire class and not the table record. I made an infolist in the ViewAction to confirm if the data I can display the information of the selected record and I'm recovering the right information, but in this case, I'm using the view of an older project and I some information from the record for the api query. Any idea? Sorry in advance if the answer is obvious, I'm relatively new to laravel. Thanks for the help! Here's what I'm getting in the record:
Closure($record) {#2221 ▼ // app/ApiWrapper.php:16
class: "App\Livewire\Stubs\ListStubs"
this: App\Livewire\Stubs\ListStubs {#1075 …}
}
Closure($record) {#2221 ▼ // app/ApiWrapper.php:16
class: "App\Livewire\Stubs\ListStubs"
this: App\Livewire\Stubs\ListStubs {#1075 …}
}
And here's my table
public function table(Table $table): Table
{
return $table
->query(Stub::query())
->columns([
// ...
])
->filters([
// ...
], layout: FiltersLayout::AboveContent)
->actions([
// dd(fn (Stub $record) => dd($record)),
ViewAction::make()
->model(Stub::class)
->view('forms.stub', ['employee' => ApiWrapper::getEmployeeStub(Auth::user()->id, fn ($record) => $record->stub_id)])
]);
}

public function table(Table $table): Table
{
return $table
->query(Stub::query())
->columns([
// ...
])
->filters([
// ...
], layout: FiltersLayout::AboveContent)
->actions([
// dd(fn (Stub $record) => dd($record)),
ViewAction::make()
->model(Stub::class)
->view('forms.stub', ['employee' => ApiWrapper::getEmployeeStub(Auth::user()->id, fn ($record) => $record->stub_id)])
]);
}

0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server