Paul Couture
c4398c641e
Prepping for launch. Reviewed-on: #1 Co-authored-by: Paul Couture <paul@paulcouture.com> Co-committed-by: Paul Couture <paul@paulcouture.com>
37 lines
1.0 KiB
PHP
37 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Support\Facades\Cache;
|
|
use Illuminate\Support\Facades\DB;
|
|
use App\Models\Podcast;
|
|
use App\Models\Artworks;
|
|
use App\Models\Episode;
|
|
|
|
|
|
class PodcastController extends Controller
|
|
{
|
|
public function show(Request $request, $slug)
|
|
{
|
|
$user = auth()->user();
|
|
$podcast = Podcast::where('slug', $slug)
|
|
->where('published', true)
|
|
->firstOrFail();
|
|
$episodes = Episode::where('published', true)
|
|
->whereNotNull('artwork_id')
|
|
->with('artwork')
|
|
->with('artworks')
|
|
->where('podcast_id', $podcast->id)
|
|
->orderBy('episode_number', 'desc')->paginate(100);
|
|
$podcasts = Podcast::where('published', true)->with('episodes')->get();
|
|
return view('podcasts.podcast', [
|
|
'user' => $user,
|
|
'pageTitle' => $podcast->name,
|
|
'podcast' => $podcast,
|
|
'episodes' => $episodes,
|
|
'podcasts' => $podcasts,
|
|
]);
|
|
}
|
|
}
|