首页 > 解决方案 > “类 App\Http\Controllers\Frontend\FrontendController 不存在”

问题描述

我安装了一个 laravel 脚本。但是页面不起作用并出现

试图获取非对象的属性“名称”(查看:/mylocal/core/resources/views/admin/users/servicePrice.blade.php)

对于这一行:

<th>{{ $item->service->name }}</th>

这是文件代码:

<div class="tile">
    @include('admin.layouts.flash')
    <h3 class="tile-title">Service Price Details</h3>
    <form method="post" action="{{ route('store.service.price', $user_id) }}">
        @csrf
        @method('PUT')
        <table class="table table-hover">
            <tbody>
            @foreach($items as $item)
            <tr>
                <th>{{ $item->category->name }}</th>
                <th>{{ $item->service->name }}</th>
                <td>
                    <div class="input-group">
                        <input type="hidden" name="id[]" value="{{ $item->id }}">
                    <input class="form-control" type="text" name="price[]" value="{{ $item->price }}">
                        <div class="input-group-append">
                            <span class="input-group-text">{{ $general->currency_symbol }}</span>
                        </div>
                    </div>
                </td>
            </tr>
            @endforeach
        </table>
        <div class="tile-footer">
            <button class="btn btn-primary btn-block btn-lg" type="submit"><i
                        class="fa fa-fw fa-lg fa-check-circle"></i>Save
            </button>
        </div>
    </form>
</div>

标签: phplaravel

解决方案


您没有共享数组 $items 的内容。请确保您在 $items 数组中有一个服务数组,并确保名称变量存在于服务数组中。你能告诉我这个结果吗: var_dump($items);


推荐阅读