Disable field if a relation manager has records

Let's say I've an order with lines and I want a select field that's in the header to be disabled if the order already has lines. I can just add a:

Select::make('field')
  ->disabled(fn (Order $order) => $order->lines()->count())


... and it will work but only when the page is entirely refreshed. It won't behave live as lines are added or removed. How can I achieve that dynamism? Maybe with events?
Was this page helpful?