我在返回return view()->with();语句上的数据时遇到了一点小麻烦。
我所得到的错误只是一个空白屏幕,带有默认的laravel导航栏。
MySQL表结构:
id _#版本_
这是我给你看的密码。
函数
function index() {
$changelogs = Changelogs::where('active', '1')->orderBy('created_at', 'desc');
return view('changelog.index')->with('changelogs', $changelogs);
}路由(如果你需要的话)
Route::get('/release-notes', 'Changelogs\MyController@index');
视图
@foreach($changelogs as $changelog)
<div class="row">
div class="col-md-10 col-md-offset-1">
div class="panel panel-default">
<div class="panel-heading">
<h3><a href="{{ url('/release-notes/'.$changelog->slug) }}">{{ $changelog->version }}</a></h3>
</div>
<div class="panel-body">
{!! $changelog->body !!}
</div>
</div>
</div>
</div>
@endforeach发布于 2016-06-27 08:18:21
发布于 2016-06-27 08:17:01
更改这一行:
$changelogs = Changelogs::where('active', '1')->orderBy('created_at', 'desc');
至:
$changelogs = Changelogs::where('active', '1')->orderBy('created_at', 'desc')->get();
希望这能有所帮助。
https://stackoverflow.com/questions/38048833
复制相似问题