Skip to content

Commit

Permalink
Improve Gallery Index Page Performance
Browse files Browse the repository at this point in the history
  • Loading branch information
AW0005 committed Aug 7, 2024
1 parent 8da3a23 commit dc8b732
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions resources/views/galleries/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,20 +51,18 @@
@endif
</div>
<div class="card-body">
@if ($gallery->submissions->where('status', 'Accepted')->count())
@if ($gallery->submissions()->where('status', 'Accepted')->count())
<div class="row">
@foreach ($gallery->submissions->where('is_visible', 1)->where('status', 'Accepted')->take(4) as $submission)
@foreach ($gallery->submissions()->where('is_visible', 1)->where('status', 'Accepted')->take(4)->get() as $submission)
<div class="col-md-3 text-center align-self-center">
@include('galleries._thumb', ['submission' => $submission, 'gallery' => true])
</div>
@endforeach
</div>
@if ($gallery->submissions->where('status', 'Accepted')->count() > 4)
@if ($gallery->submissions()->where('status', 'Accepted')->count() > 4)
<div class="text-right"><a href="{{ url('gallery/' . $gallery->id) }}">See More...</a></div>
@endif
@elseif(
$gallery->children->count() &&
App\Models\Gallery\GallerySubmission::whereIn('gallery_id', $gallery->children->pluck('id')->toArray())->where('is_visible', 1)->where('status', 'Accepted')->count())
@elseif($gallery->children->count() && App\Models\Gallery\GallerySubmission::whereIn('gallery_id', $gallery->children->pluck('id')->toArray())->where('is_visible', 1)->where('status', 'Accepted')->count())
<div class="row">
@foreach (App\Models\Gallery\GallerySubmission::whereIn('gallery_id', $gallery->children->pluck('id')->toArray())->where('is_visible', 1)->where('status', 'Accepted')->orderBy('created_at', 'DESC')->get()->take(4) as $submission)
<div class="col-md-3 text-center align-self-center">
Expand Down

0 comments on commit dc8b732

Please sign in to comment.