How to add relationship form fields on custom pages

I’ve created a custom filament page to display and edit current users details.
User model has one to one relationship with UserContact model.

In mount method I’ve added
$this->form->fill(auth()->user()->load(‘user_contact)->toArray());

Inside form, I’ve used relationship attribute for user_contact and added user contact fields.

I am getting “Call to a member function user_contact() on null” error.


My goal is to make a page where current user can edit their details.
IMG_2439.jpg
Was this page helpful?