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()">×</a>
@foreach($store_categories as $cats)
<a href="#">{{ $cats->category_of_store }}</a>
@endforeach
employ.blade.php
@section('side-menu-section')
@include('fc.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('fc.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.
Try the code below and you should be good to go:
@section('side-menu-section')
@include('fc.static.store-side-menu', ['store_categories' => $store_categories])
@endsection