【发布时间】:2017-05-02 00:39:35
【问题描述】:
我在控制器中有一个功能可以删除类别及其图像文件。但我无法访问路径属性。我收到此错误未定义属性:Illuminate\Database\Eloquent\Collection::$path。它正在返回路径,但我无法使用它。
public function remove($id) {
//$category = Category::find($id)->delete();
$category_image = CategoryImage::where('category_id', '=', $id)->get(['path']);
echo $category_image->path;
//return back();
}
【问题讨论】:
标签: php laravel model-view-controller controller laravel-5.2