Laravel 5.2 - 获取刀片视图中的项目图像

时间:2016-07-21 08:34:53

标签: php laravel laravel-5.1 laravel-5.2

我的控制器是:

public function index()

{

$details= Food::all();

return view('details.index', compact('details'));

}

public function show($Food_id)

{

 $detail=Food::findOrFail($Food_id);

 return view('details.show', compact('detail'));

}

我的index.blade.php是:

<h1>Details</h1>

<hr/>  


@foreach($details as $detail)

<detail>

<h2>

<a href="/details/{{$detail->Food_id}}">{{$detail->FoodName}}

</a>

</h2>

</detail>

@endforeach

我的show.blade.php是:

 <h1 align="center">{{$detail -> FoodName}}</h1>

<detail>

<h3><p>Name:</h3><h4>{{$detail->FoodName}}</h4></p>

我想显示存储在公共/上传文件夹中的食物图像。如何获取图像以显示它们。

1 个答案:

答案 0 :(得分:0)

假设每个cd somecurrentworkingdirectory for branch in `git branch --no-merged master` ; do echo Creating $branch git clone git://source/repos/xyz /whereveryourwebserveris/branches/$branch -b $branch ... do more stuff to get it working on your webserver ... done 对象都拥有food属性,您可以使用Laravel的image帮助程序显示上传的图像。

asset