© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•5mo ago•
1 reply
Mathias

Related page with unconventional relation to parent

Hi, I'm trying to setup a related page with an unconventional relation to parent.

Contact hasMany Bookmarks
Bookmarks belongsTo Buyer (Contact)

App\Models\Contact.php
public function bookmarks(): HasMany
    {
        return $this->hasMany(Bookmark::class);
    }
public function bookmarks(): HasMany
    {
        return $this->hasMany(Bookmark::class);
    }


App\Models\Bookmark.php
  public function buyer(): BelongsTo
    {
        return $this->belongsTo(Contact::class, 'buyer_id');
    }
  public function buyer(): BelongsTo
    {
        return $this->belongsTo(Contact::class, 'buyer_id');
    }


I've setup the inverseRelationship on the table call in the related page :
ManageContactBookmarks.php
namespace App\Filament\App\Resources\Contacts\Pages;

use ...;

class ManageContactBookmarks extends ManageRelatedRecords
{
    protected static string $resource = ContactResource::class;

    protected static string $relationship = 'bookmarks';

    protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedBookmark;

    public function form(Schema $schema): Schema
    {
        return BookmarkForm::configure($schema);
    }

    public function table(Table $table): Table
    {
        return BookmarksTable::configure($table)
            ->inverseRelationship('buyer');
    }
}
namespace App\Filament\App\Resources\Contacts\Pages;

use ...;

class ManageContactBookmarks extends ManageRelatedRecords
{
    protected static string $resource = ContactResource::class;

    protected static string $relationship = 'bookmarks';

    protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedBookmark;

    public function form(Schema $schema): Schema
    {
        return BookmarkForm::configure($schema);
    }

    public function table(Table $table): Table
    {
        return BookmarksTable::configure($table)
            ->inverseRelationship('buyer');
    }
}


Bug when i try to open the relationship page i got this 500 error :
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'bookmarks.contact_id' in 'WHERE' (Connection: mariadb, SQL: select count(*) as aggregate from 
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'bookmarks.contact_id' in 'WHERE' (Connection: mariadb, SQL: select count(*) as aggregate from 
bookmarks
 where 
 where 
bookmarks
.
.
contact_id
 = 01996b34-3e88-723a-91c9-36cbd93c6090 and 
 = 01996b34-3e88-723a-91c9-36cbd93c6090 and 
bookmarks
.
.
contact_id
 is not null and (
 is not null and (
bookmarks
.
.
deleted_at
 is null) and 
 is null) and 
bookmarks
.
.
tenant_id
 in (01996b34-3d92-72ef-93b0-66e5d7546836))
 in (01996b34-3d92-72ef-93b0-66e5d7546836))


Seems like it doesn't take into account my relationship to a specific column that doesn't follow convention.
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Retrieve parent in relation page
FilamentFFilament / ❓┊help
2y ago
Multiple relation managers on manage related records page
FilamentFFilament / ❓┊help
2y ago
Nested page (parent page)
FilamentFFilament / ❓┊help
3y ago
Combining Relation Manager table with Parent table
FilamentFFilament / ❓┊help
15mo ago