Home > OS >  Laravel dompdf view didnot match with blade view
Laravel dompdf view didnot match with blade view

Time:03-15

I got problem with Laravel DOMPDF and i dont know where is mistake

this my blade view enter image description here

this my pdf view enter image description here

this my foreach code loop

             @foreach ($hari as $hr)
                <tr>
                    <td rowspan="{{ $data->where('hari', $hr['id'])->count() }}" >
                        <center>{{ $hr['hari'] }}</center>
                    </td>
                    @foreach ($data->where('hari', $hr['id']) as $item)
                        <td>
                            {{ $item->pelajaran->nama }}
                        </td>
                        <td>
                            {{ $item->ruangan->nama }}
                        </td>
                        <td>
                            {{ $item->guru->nama }}
                        </td>
                        <td>
                            {{ substr($item->mulai, 0, -3) }} - {{ substr($item->selesai, 0, -3) }}
                        </td>
                    </tr>
                @endforeach
            @endforeach

I dont know where is my mistake, please help to solve this problem

CodePudding user response:

your first @endforeach wrong position

CodePudding user response:

Try changing your @foreach

@foreach ($hari as $hr)
            <tr>
                <td rowspan="{{ $data->where('hari', $hr['id'])->count() }}" >
                    <center>{{ $hr['hari'] }}</center>
                </td>
                @foreach ($data->where('hari', $hr['id']) as $item)
                    <td>
                        {{ $item->pelajaran->nama }}
                    </td>
                    <td>
                        {{ $item->ruangan->nama }}
                    </td>
                    <td>
                        {{ $item->guru->nama }}
                    </td>
                    <td>
                        {{ substr($item->mulai, 0, -3) }} - {{ substr($item->selesai, 0, -3) }}
                    </td>
                 @endforeach
                </tr>
        @endforeach

try changing this in your dompdf config file change the "dpi" => 96 to "dpi" => 196

  • Related