Laravel语法错误,无法正常工作

时间:2016-08-27 00:12:38

标签: laravel-5.2

第35行的FatalErrorException:语法错误,意外')',期待'(''                      

             查看部门产品             

    </section>
    <hr/>
    <table class="table table-paper table-condensed table-bordered">
        <thead>
        <tr>
            <th>#</th>
            <th>@lang('viewproductlocations.Product Name')</th>
            <th>Department Name</th>
            <th>Quantity</th>
            <th>Created At</th>
            <th>@lang('viewproductlocations.Updated At')</th>

        </tr>
        </thead>
        <tbody>

        <?php $i = 1; ?>
        @foreach ($productsInDepartments as $productsInDepartment)
            <tr class="">
            <th scope="row">{{$i}}</th>
            @foreach ($productsInDepartment->present()->groupAndSumUpProductsInDepartments as departmentProduct)

                <td>{{$departmentProduct->product->productName}}</td>
                <td>{{$departmentProduct->totalAmount}}</td>
                @endforeach

                        <td>
                            {{$productsInDepartment->name}}
                        </td>

                        <td>{{Carbon::parse($productsInDepartment->created_at)->format('d/m/Y')}} </td>
                        <td>{{Carbon::parse($productsInDepartment->updated_at)->format('d/m/Y')}} </td>
                <?php $i++; ?>
            </tr>
        @endforeach

        </tbody>
    </table>
@endsection

我收到此错误请帮助我,我收到语法错误.FatalErrorException

2 个答案:

答案 0 :(得分:0)

请发布fullCode并突出显示第35行。 但我认为你应该检查这部分

@foreach ($productsInDepartment->present()->groupAndSumUpProductsInDepartments as departmentProduct)

尝试添加 - &gt; get()

 @foreach ($productsInDepartment->present()->groupAndSumUpProductsInDepartments->get() as departmentProduct)

答案 1 :(得分:0)

我能够解决我的问题。我不得不循环我得到的结果,这是一个列表,语法错误来自我留下的其他面孔