Laravel 拉拉维尔雄辩小组(按日期)

Laravel 拉拉维尔雄辩小组(按日期),laravel,eloquent,Laravel,Eloquent,我试着在我的laravel上搜索如何在下面的图片上创建相同的结果。我试着按日期分组。同一个月的所有日期将合并到一行中。 我迄今为止所取得的成就。我无法合并具有相同月份的日期。 有人知道我是如何做到这一点的吗?谢谢 这是输出显示您的代码now@deczo这是代码。很抱歉迟了答复 <table> <thead> <tr> <th>Test Type</th> <

我试着在我的laravel上搜索如何在下面的图片上创建相同的结果。我试着按日期分组。同一个月的所有日期将合并到一行中。

我迄今为止所取得的成就。我无法合并具有相同月份的日期。 有人知道我是如何做到这一点的吗?谢谢


这是输出

显示您的代码now@deczo这是代码。很抱歉迟了答复
<table>
    <thead>
        <tr>
            <th>Test Type</th>
            <?php
                $types = Tblreporttype::all();
            ?>
            @foreach($types as $type)
                <?php  
                    $dates = Tblreportdate::with('tblreporttype')
                        ->groupBy('fDate')
                        ->where('tblreporttype_id', '=', $type->id)
                        ->get();
                ?>
                @foreach($dates as $date)
                <?php
                    $convert = $date->fDate;
                    $my_date = date('M/y', strtotime($convert));
                ?>
                    <th width="100">
                        <?php
                            if($my_date == $my_date) {
                                echo $my_date;
                            }
                        ?>
                    </th>
                @endforeach
            @endforeach
        </tr>
    </thead>
    <tbody>
            <?php  
                $dates = Tblreportdate::with('tblreporttype')
                ->groupBy('fDate')
                ->get();
            ?>
            <?php
                $types = Tblreporttype::all();
            ?>
                    @foreach($types as $type)
        <tr>
                        <td width="200">{{ $type->fType }}</td>
                    @foreach($dates as $date)
                    <?php
                        $convert = $date->fDate;
                        $my_date = date('d', strtotime($convert));
                    ?>
                    <td width="100">
                        <?php
                            if($date->tblreporttype->id == $type->id) {
                                echo $my_date; 
                            } else {
                            echo " ";
                            }
                        ?>
                    </td>
                @endforeach
        </tr>
            @endforeach
    </tbody>

</table>