Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/281.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/laravel/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 视图无法访问laravel中控制器中定义的变量_Php_Laravel_Laravel 5_Laravel 5.3 - Fatal编程技术网

Php 视图无法访问laravel中控制器中定义的变量

Php 视图无法访问laravel中控制器中定义的变量,php,laravel,laravel-5,laravel-5.3,Php,Laravel,Laravel 5,Laravel 5.3,我想不出如何写这个问题的问题 这就是我的问题 我有两种看法 store-side-menu.blade.php <a href="javascript:void(0)" class="closebtn" onclick="closeNav()">&times;</a> @foreach($store_categories as $cats) <a href="#">{{ $cats->category_of_store }}</a

我想不出如何写这个问题的问题

这就是我的问题

我有两种看法

store-side-menu.blade.php

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

@foreach($store_categories as $cats)
    <a href="#">{{ $cats->category_of_store }}</a>
@endforeach
@section('side-menu-section')
  @include('fc.static.store-side-menu')
@endsection
employ.blade.php
中,仅包括
存储端菜单.blade.php
。由于需要,我设计了这个结构

在控制器中,我有

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

现在我已经在
compact
中包含了
store\u目录
,但是
store-side菜单。blade.php
无法访问它。我如何使用它的解决方案实现目标。

尝试下面的代码,您应该可以开始了:

@section('side-menu-section')
  @include('fc.static.store-side-menu', ['store_categories' => $store_categories])
@endsection

出现什么错误???
未定义变量:store\u categories(视图:C:\wamp64\www\FlashCart\resources\views\fc\static\store side menu.blade.php)
请将错误添加到问题中。