Controller dosyam buradan istek atıyorum ve html de foreach ile ekrana basıyorum. Burada ilk 6 rapor göstersin sonra sayfa aşağıya indikçe yenisi yüklenmesini istiyorum.
Tam olarak adım adım nasıl ilerlemem gerekiyor anlatabilir misiniz nereleri güncellemem gerekiyor ne eklemem ne çıkarmam gerekiyor
public function reports()
{
$reports = ManagementReport::where('reports_status', 'published')->paginate(6);
$reportsWithImages = $reports->map(function ($report) {
$images = Media::where('model_type', 'App\Models\ManagementReport')
->where('model_id', $report->id)
->where('mime_type', 'like', 'image%')
->get();
$slug = Str::slug($report->reports_name);
return [
'report' => $report,
'images' => $images,
];
});
return view('include.reports', compact('reportsWithImages', 'reports'));
}
html kısmı
<div class="report-list row d-flex justify-content-start flex-row align-items-start flex-wrap">
@foreach($reportsWithImages as $item)
<div class="col-lg-3 col-md-6 col-sm-12">
<a href="{{ route('reportName', ['slug' => $item['report']->slug, 'id' => $item['report']->id]) }}"
class="report-item transition-hover-top report-icon">
@foreach($item['images'] as $image)
<div class="img">
<img class="lazyload" src="assets/images/no-image.png"
data-src="{{$image->getUrl()}}"
alt="{{$item['report']->reports_name}}"
title="{{$item['report']->reports_name}}"
width="260" height="367">
</div>
@endforeach
<h3>{{$item['report']->reports_name}}</h3>
<span title="Read the Report" class="read-more">
<svg xmlns="http://www.w3.org/2000/svg" width="25" height="25" viewBox="0 0 30 30">
<g id="Ellipse_20" data-name="Ellipse 20" fill="#fff" stroke="#fd0b29" stroke-width="1">
<circle cx="15" cy="15" r="15" stroke="none"></circle>
<circle cx="15" cy="15" r="14.5" fill="none"></circle>
</g>
<path id="_581e0110b683da824149a2354ae2354e" data-name="581e0110b683da824149a2354ae2354e"
d="M.163,8.06a.507.507,0,0,0,.654,0L4.642,4.68a.752.752,0,0,0,0-1.156L.789.119a.507.507,0,0,0-.649,0A.385.385,0,0,0,0,.405.384.384,0,0,0,.135.7L3.661,3.813a.376.376,0,0,1,0,.578L.163,7.482a.376.376,0,0,0,0,.578"
transform="translate(12.544 10.707)" fill="#97272a" stroke="#fd0b29" stroke-width="1"
fill-rule="evenodd"></path>
</svg>
Read the Report
</span>
</a>
</div>
@endforeach
</div>