kristijanhusak / laravel-form-builder

Laravel Form builder for version 5+!
https://packagist.org/packages/kris/laravel-form-builder
MIT License
1.71k stars 296 forks source link

Using entity how we can display format with multiple columns #713

Open sdvpnin opened 1 year ago

sdvpnin commented 1 year ago

Using entity how we can display format with multiple columns

We want the combine 2 columns value and display in entity. Example Value=>1 and display date_start - date_end. date_start and date_end is class columns.

        ->add('price_period_id', 'entity', [
            'attr' => ['class' => 'form-select'],
            'label' => __('cruds.price.fields.price_period'),
            'rules' => 'required',
            'class' => 'App\Models\Priceperiod',
            'property' => 'date_start',
            /*'query_builder' => function (Priceperiod $objPriceperiod) {
                return $objPriceperiod->date_start." - ".$objPriceperiod->date_end;
            }*/
        ])
rudiedirkx commented 1 year ago

Don't use entity, but select, and create the options/choices with pluck + attribute getter.