lundi 11 septembre 2017

How to pass an array from controller to laravel views and access them in sub-views

I am trying to pass an arrays of brands to subview banner.blade.php but it is not working. where i did wrong

my controller view

public function bannerView()
    {
        // \LOG::Info('getBrands');
        $brands = Brands::all();
        return view('home', compact('brands'));
    }

home.blade.php

@section('banner')
    @include("layouts/partials/banner")
@endsection

banner.blade.php

<select name="brand" id="branddrop" class="form-control">
                                    <option value="" selected="selected">Select Model*</option>
                                    @foreach ($brands as $brand)
                                        <option value=""></option>
                                    @endforeach
                                </select>



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire