fix: limit episode art to approved arworks
This commit is contained in:
@@ -52,10 +52,9 @@ class EpisodeController extends Controller
|
||||
{
|
||||
$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 @@ class EpisodeController extends Controller
|
||||
'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 @@ class Episode extends Model
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user