// ContractResource form()
Forms\Components\Select::make('broker_id') // this is broker_id on contract model
->label(__('Broker'))
->options(User::pluck('name', 'id'))
->default(auth()->id())
->dehydrated()
->live(),
Forms\Components\Select::make('client_id')
->label(__('Client'))
->relationship('client')
->createOptionForm([
Forms\Components\Hidden::make('broker_id') // this is broker_id on client model
->dehydrateStateUsing(fn (null $state, Forms\Get $get) => $get('broker_id')),
Forms\Components\Group::make()
->schema([
PhoneInput::make()
->required(),
EmailInput::make()
->required(),
]),
])
->createOptionModalHeading(__('Create new client')),
// ContractResource form()
Forms\Components\Select::make('broker_id') // this is broker_id on contract model
->label(__('Broker'))
->options(User::pluck('name', 'id'))
->default(auth()->id())
->dehydrated()
->live(),
Forms\Components\Select::make('client_id')
->label(__('Client'))
->relationship('client')
->createOptionForm([
Forms\Components\Hidden::make('broker_id') // this is broker_id on client model
->dehydrateStateUsing(fn (null $state, Forms\Get $get) => $get('broker_id')),
Forms\Components\Group::make()
->schema([
PhoneInput::make()
->required(),
EmailInput::make()
->required(),
]),
])
->createOptionModalHeading(__('Create new client')),