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();

  1. 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'); }

  1. Create your Filament resource and call it from there:
TextInput::make('users') ->relationship('ahlusers', 'abbr'),

And here is the error I'm receiving:

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
Was this page helpful?