【发布时间】:2021-03-06 13:03:17
【问题描述】:
我希望模型属性包含来自特定目录的文件数组
public function getGalleryAttribute($value) {
return Storage::disk('storage')->files($value);
}
然后我在页面上输出
@foreach ($item->gallery as $img)
<img src="/storage/{{ $img }}" >
@endforeach
我看到了错误
Attempt to read property "gallery" on array (View: /var/www/site/resources/views/components/postpartials/gallery.blade.php)
我不明白是什么问题
【问题讨论】: