Trying to show username but it is blank.

I have an OrderResource which I use to show Orders and OrderItems. Each order Item belongs to an Order and also to a User.
In de repeater which I have in the Resource I want to show the Username who created the OrderItem (user.name)
So I have done this:

In the OrderItem Model I have created a relationship:

  
 public function user(): BelongsTo
 {
     return $this->belongsTo(User::class);
 }

and in the OrderResource I have
return Repeater::make('items')
  ->relationship()
  ->schema([
    TextInput::make('user.name')
      ->label('Ordered by')
      ->disabled(),
]);

However the user.name shows blank. How do I make this work?
Was this page helpful?