F
Filamentβ€’14mo ago
torriv

Get record in custom page

I've made a custom view page where i want to display a table. In v2 i had this code:

protected function getViewData(): array
{
$data = $this->record->WorkoutExercises()->get();

return compact('data');
}

public function mount($record): void
{
$this->record = TrainingProgram::find($record);
}

protected function getViewData(): array
{
$data = $this->record->WorkoutExercises()->get();

return compact('data');
}

public function mount($record): void
{
$this->record = TrainingProgram::find($record);
}
and it still work, but i can see it's deprecated. How would we do it in v3?
2 Replies
Patrick Boivin
Patrick Boivinβ€’14mo ago
Just to make sure I understand - Do you need to access the $data variable from your Blade view? What is deprecated exactly?
torriv
torrivOPβ€’14mo ago
yes that's correct. I had a deprecated warning in my console earlier. but it seems like it's gone now somehow. Everything is working correct with the code in the beginning of this convo. πŸ™‚
Want results from more Discord servers?
Add your server