dras2334 2018-07-24 06:19
浏览 34
已采纳

如何向刀片模板显示计数结果

I have attendance table then I perform count to total all the Present(P)Absent(A)Late(L) now how can I show it to blade template inside the html input with 3 separated value example: value=P, value=A, value=L; right now with my code I'm getting it as all

controller:

public function get_status(){

$from = date('2018-01-01');
$to = date('2018-03-31');
$atnds = DB::table('attendances')
                 ->select(DB::raw('count(*) as total, status'))
                 ->where('status', '<>', 'status')
                 ->whereBetween('days', [$from,$to])
                 ->groupBy('status')
                 ->where('lead_id', '=', 1)
                 ->get();

                 return view('total',compact('atnds'));}

DD RESULT

[{"total":7,"status":"A"},{"total":9,"status":"L"},{"total":65,"status":"P"}]
  • 写回答

2条回答 默认 最新

  • duangenshi9836 2018-07-24 06:41
    关注

    If you want with input then you can use it like this

    <table style="width:100%">
        <tr><th>Status </th> <th>Total</th></tr>
        @foreach($atnds as $at)
            <tr>
                <td>{{ $at->status }}</td>
                <td><input type="text" value ="{{ $at->total }}" /></td>
            </tr>
        @endforeach
    </table>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)
  • ¥15 keil里为什么main.c定义的函数在it.c调用不了
  • ¥50 切换TabTip键盘的输入法
  • ¥15 可否在不同线程中调用封装数据库操作的类
  • ¥15 微带串馈天线阵列每个阵元宽度计算
  • ¥15 keil的map文件中Image component sizes各项意思
  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据