我有 2 个值 $minsRecoded 和 $totalMins,如果 minsRecorded 大于 totalMins,我想在危险徽章中显示 $totalMinsComplted。这是我的控制器中的内容$sumMins = \App\ProjectTimeLog::where('user_id', '=', '1')->pluck('total_minutes')->sum()/60; $minsRecoded = Task::getTotalMinsCompleted()/60; $totalMin = \App\ProjectTimeLog::where('user_id', '=', '1')->pluck('total_minutes')->sum()/60; $this->totalMins = \App\ProjectTimeLog::where('user_id', '=', '1')->pluck('total_minutes')->sum()/60;if ($minsRecoded < $totalMin) $this->totalMinsCompleted = '<span class="badge badge-danger">";这是我的观点 {{$totalMinsCompleted}}/{{$totalMins}}
1 回答
哔哔one
TA贡献1854条经验 获得超8个赞
使用 连接徽章.=
。当 if 条件为真时,这将保留原始内容并将徽章附加到它。
if ($minsRecoded < $totalMin) $this->totalMinsCompleted .= '<span class="badge badge-danger">';
- 1 回答
- 0 关注
- 150 浏览
添加回答
举报
0/150
提交
取消