FilamentF
Filament12mo ago
Kaaiman

EditRecord page not including user relation

I am trying to render some relational fields in the form of my CouponCode model.

TextInput::make('user.email')
  ->readOnly()
  ->disabled(),


The relation in the CouponCode model:
public function user(): BelongsTo
{
  return $this->belongsTo(User::class);
}


The migration files includes:
$table->foreignUlid('user_id')
  ->nullable()
  ->constrained('users');


Am I doing something wrong here?
Solution
use

Group::make([
    TextInput::make('email')
])->relationship('user')
Was this page helpful?