© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
19 replies
bodhi8370

Relationship Does Not Exists

I'm struggling to make two tables connect. Seems straight forward:

1. Create your two tables and migrate them. Make sure your migration in one of the tables is connected to the other:

$table->foreignId('owner_id')->constrained()->cascasdOnDelete();

2. Create models for both tables. Fill in the 'protected $fillable' and make sure to create the relationship:

public function alhusers(): HasOne {
        return $this->hasOne('ahlusers::class');    
    } 
public function alhusers(): HasOne {
        return $this->hasOne('ahlusers::class');    
    } 


3. Create your Filament resource and call it from there:

TextInput::make('users')
->relationship('ahlusers', 'abbr'),
TextInput::make('users')
->relationship('ahlusers', 'abbr'),


And here is the error I'm receiving:

Method Filament\Forms\Components\TextInput::relationship does not exist. 
Method Filament\Forms\Components\TextInput::relationship does not exist. 


Yes, I can appreciate this is exactly what it means yet I'm not sure how to troubleshoot this any further. I checked for typos and looked through Google for solutions however I can't find a solution as they are in Laravel-specific context and years old - hence my post here. Thanks in advance.
Solution
Your relationship is not defined properly. Don’t quote alhusers::class
Jump to solution
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

spa method does not exists
FilamentFFilament / ❓┊help
3y ago
Slow TextColumn with relationship exists
FilamentFFilament / ❓┊help
3y ago
Table Filter, `BooleanConstraint` relationship exists
FilamentFFilament / ❓┊help
3y ago
How to override relationship query "and not exists"
FilamentFFilament / ❓┊help
7mo ago