dimanche 12 février 2017

view cannot access variable defined in controller in laravel

I could not think how to write question for this problem.

So this is my problem.

I have two views

store-side-menu.blade.php

<a href="javascript:void(0)" class="closebtn" onclick="closeNav()">&times;</a>

@foreach($store_categories as $cats)
    <a href="#"></a>
@endforeach

employ.blade.php

@section('side-menu-section')
  @include('flashcart.static.store-side-menu')
@endsection

In employ.blade.php is only includes the store-side-menu.blade.php. I have designed this structure due to need.

In controller I have

public function employment()
{
    $search = "";
    $store_categoies = Category::all();
    return view('flashcart.employ.employ', compact('search', 'store_categories'));
}

Now I have included store_categories in compact but store-side-menu.blade.php cannot access it. How do I achieve with its solution.



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2kgoYyh
via IFTTT

Aucun commentaire:

Enregistrer un commentaire