jeudi 25 juin 2020

Undefined variable in blade file

I am beginner in Laravel and web development. I have this code in blade file:

@foreach($plates as $value)
                                            @if ($value->type == 1)
                                                <div class="form-group row">
                                                    <div class="col-lg-4 col-md-4 col-sm-12 text-right pt-2">
                                                        <input type="checkbox"
                                                               class="xxxxxx mr-2"
                                                               name="plate-ch-"  @if(old('plate-ch-'.$value->id, $selectedProductFeatures['plate-ch-'.$value->id])) checked @endif
                                                               value="1" >
                                                        <label></label>
                                                    </div>
                                                   
                                                </div>
                                            @endif
                                        @endforeach

I have error:

Undefined variable: selectedProductFeatures (View: /Applications/XAMPP/xamppfiles/htdocs/roelle/resources/views/admin/products/view.blade.php)

This is wrong line: name="countertop-ch-" @if(old('countertop-ch-'.$value->id, $selectedProductFeatures['countertop-ch-'.$value->id])) checked @endif

I have a universal template for adding and editing a product.

How can I repair it?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire