如何解决解析错误:语法错误,意外的')',期望的'['?

时间:2019-10-06 18:01:40

标签: php laravel

 @extends('admin.layouts.app_admin')

@section('content') 

<div class="container">

     @component('admin.components.breadcrumb')
        @slot('title') all_ category @endslot
        @slot('parent') main @endslot
        @slot('active') category @endslot
    @endcomponent 
    <hr>


 <a href="{{route('admin.category.create')}}" class="btn btn-primary pull-right">
        <i class="fa fa-plus-square-0">Создать категорию</i></a>
        <table class="table table-striped">
                <th>XXX</th>
                <th>XXX</th>
                <th class="text-right">XXX</th>
<tbody>
                @forelse ($categories as category)
                <tr>
                    <td>{{$category->title}}</td>
                    <td>{{$category->published}}</td>
                    <td>
                         <a href="{{route('admin.category.edit', ['id'=>$category->id])}}"><i class="fa fa-edit "></i></a>
                    </td>
                </tr>
                @empty
                <tr>
                    <td colspan="3" class="text-center"><h2>not found</h2></td>
                </tr>
                @endforelse
            </tbody>
        </table>

</div>

 @endsection 

此文件中有这样的错误 解析错误:语法错误,意外的')',期望为'['(视图:D:\ wamp \ www \博客\资源\视图\ admin \类别\ index.blade.php) 请帮助我解决它,我已经伤了头,找不到错误

即使文件为空,它仍然会显示此错误

1 个答案:

答案 0 :(得分:1)

正确命名类别变量

@forelse ($categories as $category)

希望这会有所帮助