fix: limit episode art to approved arworks #5
@ -52,10 +52,9 @@ public function show(Request $request, $podcast_slug, $slug)
|
||||
{
|
||||
$user = auth()->user();
|
||||
$episode = Episode::where('slug', $slug)
|
||||
->with('artworks')
|
||||
->with('approvedArtworks')
|
||||
->with('artwork')
|
||||
->with('podcast')
|
||||
->whereNotNull('artworks.approved_by')
|
||||
->firstOrFail();
|
||||
$podcasts = Podcast::where('published', true)->with('episodes', function ($query) {
|
||||
$query->orderBy('episode_number', 'desc');
|
||||
@ -67,6 +66,7 @@ public function show(Request $request, $podcast_slug, $slug)
|
||||
'pageTitle' => '"' . $episode->title . '" ' . $episode->podcast->name . ' Episode ' . number_format($episode->episode_number + 0),
|
||||
'podcast' => $episode->podcast,
|
||||
'episode' => $episode,
|
||||
'artworks' => $episode->approvedArtworks,
|
||||
'podcasts' => $podcasts,
|
||||
]);
|
||||
}
|
||||
|
@ -31,6 +31,11 @@ public function artwork()
|
||||
return $this->hasOne(Artwork::class, 'id', 'artwork_id');
|
||||
}
|
||||
|
||||
public function approvedArtworks()
|
||||
{
|
||||
return $this->hasMany(Artwork::class)->whereNotNull('artworks.approved_by');
|
||||
}
|
||||
|
||||
public function artworks()
|
||||
{
|
||||
return $this->hasMany(Artwork::class);
|
||||
|
@ -44,7 +44,7 @@
|
||||
{{ $episode->episode_date->format('Y') }}</h4>
|
||||
<h4 class="mb-4">Artwork By: <a href="/artist/{{ $episode->artwork->artist->slug }}">{{ $episode->artwork->artist->name }}</a></h4>
|
||||
<p class="subtitle">
|
||||
{{ number_format($episode->artworks->count()) }} Artworks Submitted.
|
||||
{{ number_format($artworks->count()) }} Artworks Submitted.
|
||||
</p>
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
@ -88,14 +88,14 @@ class="ri-broadcast-line"></i>
|
||||
<div class="container">
|
||||
<div class="section-title">
|
||||
<span class="subtitle">Other Submitted Artworks</span>
|
||||
<h3>{{ number_format($episode->artworks->count() - 1) }} other art pieces submitted</h3>
|
||||
<h3>{{ number_format($artworks->count() - 1) }} other art pieces submitted</h3>
|
||||
</div>
|
||||
</div>
|
||||
<div class="container">
|
||||
{{-- End .section-title --}}
|
||||
<div class="grid-filter-wrapper masonry-list">
|
||||
<div class="resizer"></div>
|
||||
@foreach ($episode->artworks as $recent)
|
||||
@foreach ($artworks as $recent)
|
||||
@if ($recent->id != $episode->artwork_id)
|
||||
@php
|
||||
$thisArtwork = $recent;
|
||||
|
Loading…
Reference in New Issue
Block a user