How to access current model in custom view page

I made a livewire component and included it in a view page, but how can I access the current model in order to show the related data ?

Basically I want to make table of the relation with links to edit that relation, but to keep the edit page clean I dont want to include a relation manager there.

class ViewApartment extends Component implements HasForms, HasTable
{
    use InteractsWithTable;
    use InteractsWithForms;

    public function table(Table $table): Table
    {
        return $table
            ->query(function (\App\Models\Apartment $record) { \Log::debug($record); return \App\Models\Ownership::where("apartment_name", $record->name); })
            ->columns([
                TextColumn::make('name'),
            ])
            ->filters([])
            ->actions([])
            ->bulkActions([]);
    }

    public function render()
    {
        return view('livewire.view-apartment');
    }
}
Was this page helpful?