0
嘿,這是一個laravel主頁應該顯示用戶從數據庫的任務列表,我有一個問題,在刷新頁面後,我不知道爲什麼,但它停止加載和顯示像我附在問題中的截圖。 任何幫助?Laravel @foreach在刀片上造成bug
@extends('layouts.app')
@section('content')
<div class="container">
@include('flash::message')
<div class="panel panel-default">
<div class="panel-heading">Dashboard</div>
<div class="panel-body">
<!-- Check if the user has any tasks to show -->
@unless($tasks->isEmpty())
@foreach($tasks as $task)
<ul class="list-group">
<li class="list-group-item">
<a class="{{ $task->state == 1 ? ' done-task':'' }}" href="{{url('/tasks',$task->id)}}">
{!! $task->name !!}
</a>
<span class="badge">@if($task->priority == 3)
<i class="fa fa-flag fa-2x flag-important"></i>
@elseif($task->priority ==2)
<i class="fa fa-flag fa-2x flag-normal"></i>
@elseif($task->priority ==1)
<i class="fa fa-flag fa-2x flag-low"></i>
@endif</span></li>
</ul>
{{[email protected]($task->priority == 3) {{'list-group-item-danger'}}
@elseif($task->priority == 2){{' list-group-item-warning '}}
@elseif($task->priority == 1){{'list-group-item-success'}}
@endif--}}
@endforeach
@else
<h2 class="text-center">Nothing To show</h2>
@endunless
</div>
</div>
<a class="btn btn-success btn-block" href="{!! url('tasks/create') !!}">Create New Task</a>
</div>
@endsection
「_that刷新頁面後_」所以這是第一次,但刷新後它錯誤? –
多次重新載入您的頁面,等待錯誤發生,並在開發人員工具中打開頁面。查找生成的HTML代碼並將其複製粘貼到問題中。它會顯示它打破的位置。 –