未定义 属性:Illuminate\Pagination\LengthAwarePaginator::$images

Undefined property: Illuminate\Pagination\LengthAwarePaginator::$images

我试图显示 tinghirs table 图像字段的图像,但遗憾的是它给我错误 Undefined property: Illuminate \ Pagination \ LengthAwarePaginator :: $ images

TinghirsController.php

public function index()
    {
       $tinghirs=Tinghir::paginate(48);
       return view('tinghirs.index', ['tinghirs' => $tinghirs]);
    }

index.php

<div class="row mix-grid thumbnails">
                            @if ($tinghirs->images)
                            @foreach (json_decode($tinghirs->images, true) as $images)
                            <div class="col-md-6 col-xs-6 mix cat_nature cat_all">
                                <a class="thumbnail-item">
                                    <img src="{{ Voyager::image($images) }}" style="width:600px;height:400px">
                                    <div class="thumbnail-info">
                                        <p>Curabitur ut lorem id tellus malesuada tincidunt et eget purus</p>
                                        <button class="btn btn-primary"><span class="fa fa-link"></span></button>
                                        <button class="btn btn-primary"><span class="fa fa-eye"></span></button>
                                    </div>
                                </a>
                            </div>
                            @endforeach
                            @endif
                    </div>

您 return 一个分页器对象,您必须对其调用 items() 或遍历它。

我想代码可能与此类似。您使用 json 解码的方式看起来超级奇怪,您可能做错了什么。

@foreach(($tinghirs as $tinghir)
    <div class="col-md-6 col-xs-6 mix cat_nature cat_all">
        <a class="thumbnail-item">
            <img src="{{ Voyager::image($tinghir->images) }}" style="width:600px;height:400px">
            <div class="thumbnail-info">
            <p>Curabitur ut lorem id tellus malesuada tincidunt et eget purus</p>
            <button class="btn btn-primary"><span class="fa fa-link"></span>                 </button>
            <button class="btn btn-primary"><span class="fa fa-eye"></span></button>
        </a>
    </div>
@endforeach