in database I have products with custom features and custom feature values. For example product has a "wood type" and option value "oak". Each feature and feature value could have translations.
In database I have:
features
- id
- few other fields (no matter)
feature_langs
- id_feature
- id_lang
- name
feature_values
- id
- few other fieds (no matter)
feature_value_langs
- id_feature_value
- id_lang
- name
And now in product edition I use htmlCollective and display 40x selects with multiple options and it looks like this:
Problem is that with features loading page takes 1-1,8s randomly. Without that loading is close to 500-600ms.
For db query I use simply:
$features = Feature::with('translation')->get();
$featureValues = FeatureValue::with('translation')->get();
And form displaying:
@forelse($features as $feature)
<div class="form-group m-form__group row">
<label class="col-2 col-form-label">{{ $feature->getName() }}</label>
<div class="col-5">
{!! Form::select('featureValue',$featureValues->where('id_feature',$feature->id)->map(function ($setting) {
return ['key' => $setting->getName(), 'value' => $setting->id];
})->pluck('key', 'value')->prepend('Choose', '')->toArray(), null, array('class' => 'form-control')) !!}
</div>
</div>
@empty
No data
@endforelse
Is there some bottleneck or I am missing something?
Many thanks for any help