2023-06-21 09:53:21 -04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
|
|
|
|
use Illuminate\Http\Request;
|
2023-12-14 12:33:03 -05:00
|
|
|
use Illuminate\Support\Facades\Cache;
|
|
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
use App\Models\Podcast;
|
|
|
|
use App\Models\Artworks;
|
|
|
|
use App\Models\Episode;
|
2023-06-21 09:53:21 -04:00
|
|
|
|
|
|
|
class EpisodeController extends Controller
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Display a listing of the resource.
|
|
|
|
*
|
|
|
|
* @return \Illuminate\Http\Response
|
|
|
|
*/
|
|
|
|
public function index()
|
|
|
|
{
|
|
|
|
//
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Show the form for creating a new resource.
|
|
|
|
*
|
|
|
|
* @return \Illuminate\Http\Response
|
|
|
|
*/
|
|
|
|
public function create()
|
|
|
|
{
|
|
|
|
//
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Store a newly created resource in storage.
|
|
|
|
*
|
|
|
|
* @param \Illuminate\Http\Request $request
|
|
|
|
* @return \Illuminate\Http\Response
|
|
|
|
*/
|
|
|
|
public function store(Request $request)
|
|
|
|
{
|
|
|
|
//
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Display the specified resource.
|
|
|
|
*
|
|
|
|
* @param \App\Models\Episode $episode
|
|
|
|
* @return \Illuminate\Http\Response
|
|
|
|
*/
|
2023-12-14 12:33:03 -05:00
|
|
|
public function show(Request $request, $podcast_slug, $slug)
|
2023-06-21 09:53:21 -04:00
|
|
|
{
|
2023-12-14 12:33:03 -05:00
|
|
|
$user = auth()->user();
|
|
|
|
$episode = Episode::where('slug', $slug)
|
2024-01-13 12:30:38 -05:00
|
|
|
->with('approvedArtworks')
|
2023-12-14 12:33:03 -05:00
|
|
|
->with('artwork')
|
|
|
|
->with('podcast')
|
|
|
|
->firstOrFail();
|
|
|
|
$podcasts = Podcast::where('published', true)->with('episodes', function ($query) {
|
|
|
|
$query->orderBy('episode_number', 'desc');
|
|
|
|
$query->where('published', true);
|
|
|
|
$query->take(10);
|
|
|
|
})->get();
|
|
|
|
return view('episodes.episode', [
|
|
|
|
'user' => $user,
|
|
|
|
'pageTitle' => '"' . $episode->title . '" ' . $episode->podcast->name . ' Episode ' . number_format($episode->episode_number + 0),
|
|
|
|
'podcast' => $episode->podcast,
|
|
|
|
'episode' => $episode,
|
2024-01-13 12:30:38 -05:00
|
|
|
'artworks' => $episode->approvedArtworks,
|
2023-12-14 12:33:03 -05:00
|
|
|
'podcasts' => $podcasts,
|
|
|
|
]);
|
2023-06-21 09:53:21 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Show the form for editing the specified resource.
|
|
|
|
*
|
|
|
|
* @param \App\Models\Episode $episode
|
|
|
|
* @return \Illuminate\Http\Response
|
|
|
|
*/
|
|
|
|
public function edit(Episode $episode)
|
|
|
|
{
|
|
|
|
//
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Update the specified resource in storage.
|
|
|
|
*
|
|
|
|
* @param \Illuminate\Http\Request $request
|
|
|
|
* @param \App\Models\Episode $episode
|
|
|
|
* @return \Illuminate\Http\Response
|
|
|
|
*/
|
|
|
|
public function update(Request $request, Episode $episode)
|
|
|
|
{
|
|
|
|
//
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Remove the specified resource from storage.
|
|
|
|
*
|
|
|
|
* @param \App\Models\Episode $episode
|
|
|
|
* @return \Illuminate\Http\Response
|
|
|
|
*/
|
|
|
|
public function destroy(Episode $episode)
|
|
|
|
{
|
|
|
|
//
|
|
|
|
}
|
|
|
|
}
|