heading(__('lunarpanel::address.plural_label')) ->columns([ TextColumn::make('line_one')->label( __('lunarpanel::address.table.line_one.label') ), TextColumn::make('city')->label( __('lunarpanel::address.table.city.label') ), TextColumn::make('postcode')->label( __('lunarpanel::address.table.postcode.label') ), TextColumn::make('contact_email')->label( __('lunarpanel::address.table.contact_email.label') ), TextColumn::make('contact_phone')->label( __('lunarpanel::address.table.contact_phone.label') ), ]) ->headerActions([ CreateAction::make()->schema($this->addressForm()), ]) ->recordActions([ EditAction::make('editAddress') ->fillForm(fn (AddressContract $record): array => [ 'line_one' => $record->line_one, 'city' => $record->city, 'state' => $record->state, 'postcode' => $record->postcode, 'country_id' => $record->country_id, 'contact_email' => $record->contact_email, 'contact_phone' => $record->contact_phone, ]) ->schema($this->addressForm()), DeleteAction::make('deleteAddress'), ]); } protected function addressForm(): array // phpcs:ignore { return [ TextInput::make('line_one')->label( __('lunarpanel::address.form.line_one.label') )->required(), Group::make()->schema([ Select::make('country_id')->label( __('lunarpanel::address.form.country_id.label') )->relationship( name: 'country', )->getOptionLabelFromRecordUsing(function (Model $record) { $name = $record->native ?: $record->name; return "{$record->emoji} $name"; }), TextInput::make('state')->label( __('lunarpanel::address.form.state.label') ), ])->columns(2), Group::make()->schema([ TextInput::make('city')->label( __('lunarpanel::address.form.city.label') )->required(), TextInput::make('postcode')->label( __('lunarpanel::address.form.postcode.label') ), ])->columns(2), Group::make()->schema([ TextInput::make('contact_email')->label( __('lunarpanel::address.form.contact_email.label') ), TextInput::make('contact_phone')->label( __('lunarpanel::address.form.contact_phone.label') ), ])->columns(2), ]; } }