Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • adaures/castopod
  • mkljczk/castopod-host
  • spaetz/castopod-host
  • PatrykMis/castopod
  • jonas/castopod
  • ajeremias/castopod
  • misuzu/castopod
  • KrzysztofDomanczyk/castopod
  • Behel/castopod
  • nebulon/castopod
  • ewen/castopod
  • NeoluxConsulting/castopod
  • nateritter/castopod-og
  • prcutler/castopod
14 results
Show changes
Showing
with 178 additions and 95 deletions
...@@ -13,7 +13,7 @@ namespace App\Controllers; ...@@ -13,7 +13,7 @@ namespace App\Controllers;
use App\Entities\Episode; use App\Entities\Episode;
use App\Models\EpisodeModel; use App\Models\EpisodeModel;
use CodeIgniter\Exceptions\PageNotFoundException; use CodeIgniter\Exceptions\PageNotFoundException;
use CodeIgniter\HTTP\RedirectResponse; use Modules\Media\FileManagers\FileManagerInterface;
class EpisodePreviewController extends BaseController class EpisodePreviewController extends BaseController
{ {
...@@ -44,7 +44,7 @@ class EpisodePreviewController extends BaseController ...@@ -44,7 +44,7 @@ class EpisodePreviewController extends BaseController
return $this->{$method}(...$params); return $this->{$method}(...$params);
} }
public function index(): RedirectResponse | string public function index(): string
{ {
helper('form'); helper('form');
...@@ -54,7 +54,7 @@ class EpisodePreviewController extends BaseController ...@@ -54,7 +54,7 @@ class EpisodePreviewController extends BaseController
]); ]);
} }
public function activity(): RedirectResponse | string public function activity(): string
{ {
helper('form'); helper('form');
...@@ -64,11 +64,49 @@ class EpisodePreviewController extends BaseController ...@@ -64,11 +64,49 @@ class EpisodePreviewController extends BaseController
]); ]);
} }
public function chapters(): RedirectResponse | string public function chapters(): string
{ {
return view('episode/preview-chapters', [ $data = [
'podcast' => $this->episode->podcast, 'podcast' => $this->episode->podcast,
'episode' => $this->episode, 'episode' => $this->episode,
]); ];
if (isset($this->episode->chapters->file_key)) {
/** @var FileManagerInterface $fileManager */
$fileManager = service('file_manager');
$episodeChaptersJsonString = (string) $fileManager->getFileContents($this->episode->chapters->file_key);
$chapters = json_decode($episodeChaptersJsonString, true);
$data['chapters'] = $chapters;
}
helper('form');
return view('episode/preview-chapters', $data);
}
public function transcript(): string
{
// get transcript from json file
$data = [
'podcast' => $this->episode->podcast,
'episode' => $this->episode,
];
if ($this->episode->transcript !== null) {
$data['transcript'] = $this->episode->transcript;
if ($this->episode->transcript->json_key !== null) {
/** @var FileManagerInterface $fileManager */
$fileManager = service('file_manager');
$transcriptJsonString = (string) $fileManager->getFileContents(
$this->episode->transcript->json_key,
);
$data['captions'] = json_decode($transcriptJsonString, true);
}
}
helper('form');
return view('episode/preview-transcript', $data);
} }
} }
...@@ -33,14 +33,25 @@ class FeedController extends Controller ...@@ -33,14 +33,25 @@ class FeedController extends Controller
public function index(string $podcastHandle): ResponseInterface public function index(string $podcastHandle): ResponseInterface
{ {
helper(['rss', 'premium_podcasts', 'misc']);
$podcast = (new PodcastModel())->where('handle', $podcastHandle) $podcast = (new PodcastModel())->where('handle', $podcastHandle)
->first(); ->first();
if (! $podcast instanceof Podcast) { if (! $podcast instanceof Podcast) {
throw PageNotFoundException::forPageNotFound(); throw PageNotFoundException::forPageNotFound();
} }
// 301 redirect to new feed?
$redirectToNewFeed = service('settings')
->get('Podcast.redirect_to_new_feed', 'podcast:' . $podcast->id);
if ($redirectToNewFeed && $podcast->new_feed_url !== null && filter_var(
$podcast->new_feed_url,
FILTER_VALIDATE_URL,
) && $podcast->new_feed_url !== current_url()) {
return redirect()->to($podcast->new_feed_url, 301);
}
helper(['rss', 'premium_podcasts', 'misc']);
$service = null; $service = null;
try { try {
$service = UserAgentsRSS::find(service('superglobals')->server('HTTP_USER_AGENT')); $service = UserAgentsRSS::find(service('superglobals')->server('HTTP_USER_AGENT'));
...@@ -66,7 +77,7 @@ class FeedController extends Controller ...@@ -66,7 +77,7 @@ class FeedController extends Controller
"podcast#{$podcast->id}", "podcast#{$podcast->id}",
'feed', 'feed',
$service ? $serviceSlug : null, $service ? $serviceSlug : null,
$subscription instanceof Subscription ? 'unlocked' : null, $subscription instanceof Subscription ? "subscription#{$subscription->id}" : null,
]), ]),
); );
...@@ -79,13 +90,7 @@ class FeedController extends Controller ...@@ -79,13 +90,7 @@ class FeedController extends Controller
); );
cache() cache()
->save( ->save($cacheName, $found, $secondsToNextUnpublishedEpisode ?: DECADE);
$cacheName,
$found,
$secondsToNextUnpublishedEpisode
? $secondsToNextUnpublishedEpisode
: DECADE,
);
} }
return $this->response->setXML($found); return $this->response->setXML($found);
......
...@@ -14,7 +14,6 @@ use App\Models\PodcastModel; ...@@ -14,7 +14,6 @@ use App\Models\PodcastModel;
use CodeIgniter\Database\Exceptions\DatabaseException; use CodeIgniter\Database\Exceptions\DatabaseException;
use CodeIgniter\HTTP\RedirectResponse; use CodeIgniter\HTTP\RedirectResponse;
use CodeIgniter\HTTP\ResponseInterface; use CodeIgniter\HTTP\ResponseInterface;
use Config\Cache;
use Modules\Media\FileManagers\FileManagerInterface; use Modules\Media\FileManagers\FileManagerInterface;
class HomeController extends BaseController class HomeController extends BaseController
...@@ -23,7 +22,7 @@ class HomeController extends BaseController ...@@ -23,7 +22,7 @@ class HomeController extends BaseController
{ {
$sortOptions = ['activity', 'created_desc', 'created_asc']; $sortOptions = ['activity', 'created_desc', 'created_asc'];
$sortBy = in_array($this->request->getGet('sort'), $sortOptions, true) ? $this->request->getGet( $sortBy = in_array($this->request->getGet('sort'), $sortOptions, true) ? $this->request->getGet(
'sort' 'sort',
) : 'activity'; ) : 'activity';
$allPodcasts = (new PodcastModel())->getAllPodcasts($sortBy); $allPodcasts = (new PodcastModel())->getAllPodcasts($sortBy);
...@@ -33,9 +32,9 @@ class HomeController extends BaseController ...@@ -33,9 +32,9 @@ class HomeController extends BaseController
return redirect()->route('podcast-activity', [$allPodcasts[0]->handle]); return redirect()->route('podcast-activity', [$allPodcasts[0]->handle]);
} }
set_home_metatags();
// default behavior: list all podcasts on home page // default behavior: list all podcasts on home page
$data = [ $data = [
'metatags' => get_home_metatags(),
'podcasts' => $allPodcasts, 'podcasts' => $allPodcasts,
'sortBy' => $sortBy, 'sortBy' => $sortBy,
]; ];
...@@ -54,7 +53,7 @@ class HomeController extends BaseController ...@@ -54,7 +53,7 @@ class HomeController extends BaseController
} }
// --- Can Castopod connect to the cache handler // --- Can Castopod connect to the cache handler
if (config(Cache::class)->handler !== 'dummy' && cache()->getCacheInfo() === null) { if (config('Cache')->handler !== 'dummy' && cache()->getCacheInfo() === null) {
$errors[] = 'Unable connect to the cache handler.'; $errors[] = 'Unable connect to the cache handler.';
} }
......
...@@ -49,9 +49,9 @@ class PageController extends BaseController ...@@ -49,9 +49,9 @@ class PageController extends BaseController
); );
if (! ($found = cache($cacheName))) { if (! ($found = cache($cacheName))) {
set_page_metatags($this->page);
$data = [ $data = [
'metatags' => get_page_metatags($this->page), 'page' => $this->page,
'page' => $this->page,
]; ];
$found = view('pages/page', $data); $found = view('pages/page', $data);
......
...@@ -17,7 +17,7 @@ use App\Models\EpisodeModel; ...@@ -17,7 +17,7 @@ use App\Models\EpisodeModel;
use App\Models\PodcastModel; use App\Models\PodcastModel;
use App\Models\PostModel; use App\Models\PostModel;
use CodeIgniter\Exceptions\PageNotFoundException; use CodeIgniter\Exceptions\PageNotFoundException;
use CodeIgniter\HTTP\Response; use CodeIgniter\HTTP\ResponseInterface;
use Modules\Analytics\AnalyticsTrait; use Modules\Analytics\AnalyticsTrait;
use Modules\Fediverse\Objects\OrderedCollectionObject; use Modules\Fediverse\Objects\OrderedCollectionObject;
use Modules\Fediverse\Objects\OrderedCollectionPage; use Modules\Fediverse\Objects\OrderedCollectionPage;
...@@ -47,7 +47,7 @@ class PodcastController extends BaseController ...@@ -47,7 +47,7 @@ class PodcastController extends BaseController
return $this->{$method}(...$params); return $this->{$method}(...$params);
} }
public function podcastActor(): Response public function podcastActor(): ResponseInterface
{ {
$podcastActor = new PodcastActor($this->podcast); $podcastActor = new PodcastActor($this->podcast);
...@@ -58,10 +58,7 @@ class PodcastController extends BaseController ...@@ -58,10 +58,7 @@ class PodcastController extends BaseController
public function activity(): string public function activity(): string
{ {
// Prevent analytics hit when authenticated $this->registerPodcastWebpageHit($this->podcast->id);
if (! auth()->loggedIn()) {
$this->registerPodcastWebpageHit($this->podcast->id);
}
$cacheName = implode( $cacheName = implode(
'_', '_',
...@@ -78,10 +75,10 @@ class PodcastController extends BaseController ...@@ -78,10 +75,10 @@ class PodcastController extends BaseController
); );
if (! ($cachedView = cache($cacheName))) { if (! ($cachedView = cache($cacheName))) {
set_podcast_metatags($this->podcast, 'activity');
$data = [ $data = [
'metatags' => get_podcast_metatags($this->podcast, 'activity'), 'podcast' => $this->podcast,
'podcast' => $this->podcast, 'posts' => (new PostModel())->getActorPublishedPosts($this->podcast->actor_id),
'posts' => (new PostModel())->getActorPublishedPosts($this->podcast->actor_id),
]; ];
// if user is logged in then send to the authenticated activity view // if user is logged in then send to the authenticated activity view
...@@ -96,9 +93,7 @@ class PodcastController extends BaseController ...@@ -96,9 +93,7 @@ class PodcastController extends BaseController
); );
return view('podcast/activity', $data, [ return view('podcast/activity', $data, [
'cache' => $secondsToNextUnpublishedEpisode 'cache' => $secondsToNextUnpublishedEpisode ?: DECADE,
? $secondsToNextUnpublishedEpisode
: DECADE,
'cache_name' => $cacheName, 'cache_name' => $cacheName,
]); ]);
} }
...@@ -108,10 +103,7 @@ class PodcastController extends BaseController ...@@ -108,10 +103,7 @@ class PodcastController extends BaseController
public function about(): string public function about(): string
{ {
// Prevent analytics hit when authenticated $this->registerPodcastWebpageHit($this->podcast->id);
if (! auth()->loggedIn()) {
$this->registerPodcastWebpageHit($this->podcast->id);
}
$cacheName = implode( $cacheName = implode(
'_', '_',
...@@ -130,10 +122,10 @@ class PodcastController extends BaseController ...@@ -130,10 +122,10 @@ class PodcastController extends BaseController
if (! ($cachedView = cache($cacheName))) { if (! ($cachedView = cache($cacheName))) {
$stats = (new EpisodeModel())->getPodcastStats($this->podcast->id); $stats = (new EpisodeModel())->getPodcastStats($this->podcast->id);
set_podcast_metatags($this->podcast, 'about');
$data = [ $data = [
'metatags' => get_podcast_metatags($this->podcast, 'about'), 'podcast' => $this->podcast,
'podcast' => $this->podcast, 'stats' => $stats,
'stats' => $stats,
]; ];
// // if user is logged in then send to the authenticated activity view // // if user is logged in then send to the authenticated activity view
...@@ -148,9 +140,7 @@ class PodcastController extends BaseController ...@@ -148,9 +140,7 @@ class PodcastController extends BaseController
); );
return view('podcast/about', $data, [ return view('podcast/about', $data, [
'cache' => $secondsToNextUnpublishedEpisode 'cache' => $secondsToNextUnpublishedEpisode ?: DECADE,
? $secondsToNextUnpublishedEpisode
: DECADE,
'cache_name' => $cacheName, 'cache_name' => $cacheName,
]); ]);
} }
...@@ -160,10 +150,7 @@ class PodcastController extends BaseController ...@@ -160,10 +150,7 @@ class PodcastController extends BaseController
public function episodes(): string public function episodes(): string
{ {
// Prevent analytics hit when authenticated $this->registerPodcastWebpageHit($this->podcast->id);
if (! auth()->loggedIn()) {
$this->registerPodcastWebpageHit($this->podcast->id);
}
$yearQuery = $this->request->getGet('year'); $yearQuery = $this->request->getGet('year');
$seasonQuery = $this->request->getGet('season'); $seasonQuery = $this->request->getGet('season');
...@@ -249,8 +236,8 @@ class PodcastController extends BaseController ...@@ -249,8 +236,8 @@ class PodcastController extends BaseController
]; ];
} }
set_podcast_metatags($this->podcast, 'episodes');
$data = [ $data = [
'metatags' => get_podcast_metatags($this->podcast, 'episodes'),
'podcast' => $this->podcast, 'podcast' => $this->podcast,
'episodesNav' => $episodesNavigation, 'episodesNav' => $episodesNavigation,
'activeQuery' => $activeQuery, 'activeQuery' => $activeQuery,
...@@ -270,9 +257,7 @@ class PodcastController extends BaseController ...@@ -270,9 +257,7 @@ class PodcastController extends BaseController
$this->podcast->id, $this->podcast->id,
); );
return view('podcast/episodes', $data, [ return view('podcast/episodes', $data, [
'cache' => $secondsToNextUnpublishedEpisode 'cache' => $secondsToNextUnpublishedEpisode ?: DECADE,
? $secondsToNextUnpublishedEpisode
: DECADE,
'cache_name' => $cacheName, 'cache_name' => $cacheName,
]); ]);
} }
...@@ -280,15 +265,15 @@ class PodcastController extends BaseController ...@@ -280,15 +265,15 @@ class PodcastController extends BaseController
return $cachedView; return $cachedView;
} }
public function episodeCollection(): Response public function episodeCollection(): ResponseInterface
{ {
if ($this->podcast->type === 'serial') { if ($this->podcast->type === 'serial') {
// podcast is serial // podcast is serial
$episodes = model(EpisodeModel::class) $episodes = model('EpisodeModel')
->where('`published_at` <= UTC_TIMESTAMP()', null, false) ->where('`published_at` <= UTC_TIMESTAMP()', null, false)
->orderBy('season_number DESC, number ASC'); ->orderBy('season_number DESC, number ASC');
} else { } else {
$episodes = model(EpisodeModel::class) $episodes = model('EpisodeModel')
->where('`published_at` <= UTC_TIMESTAMP()', null, false) ->where('`published_at` <= UTC_TIMESTAMP()', null, false)
->orderBy('published_at', 'DESC'); ->orderBy('published_at', 'DESC');
} }
...@@ -321,9 +306,9 @@ class PodcastController extends BaseController ...@@ -321,9 +306,9 @@ class PodcastController extends BaseController
public function links(): string public function links(): string
{ {
set_podcast_metatags($this->podcast, 'links');
return view('podcast/links', [ return view('podcast/links', [
'metatags' => get_podcast_metatags($this->podcast, 'links'), 'podcast' => $this->podcast,
'podcast' => $this->podcast,
]); ]);
} }
} }
...@@ -22,6 +22,7 @@ use CodeIgniter\HTTP\URI; ...@@ -22,6 +22,7 @@ use CodeIgniter\HTTP\URI;
use CodeIgniter\I18n\Time; use CodeIgniter\I18n\Time;
use Modules\Analytics\AnalyticsTrait; use Modules\Analytics\AnalyticsTrait;
use Modules\Fediverse\Controllers\PostController as FediversePostController; use Modules\Fediverse\Controllers\PostController as FediversePostController;
use Override;
class PostController extends FediversePostController class PostController extends FediversePostController
{ {
...@@ -37,12 +38,14 @@ class PostController extends FediversePostController ...@@ -37,12 +38,14 @@ class PostController extends FediversePostController
protected $post; protected $post;
/** /**
* @var string[] * @var list<string>
*/ */
protected $helpers = ['auth', 'fediverse', 'svg', 'components', 'misc', 'seo', 'premium_podcasts']; protected $helpers = ['auth', 'fediverse', 'svg', 'components', 'misc', 'seo', 'premium_podcasts'];
#[Override]
public function _remap(string $method, string ...$params): mixed public function _remap(string $method, string ...$params): mixed
{ {
if ( if (
! ($podcast = (new PodcastModel())->getPodcastByHandle($params[0])) instanceof Podcast ! ($podcast = (new PodcastModel())->getPodcastByHandle($params[0])) instanceof Podcast
) { ) {
...@@ -52,29 +55,29 @@ class PostController extends FediversePostController ...@@ -52,29 +55,29 @@ class PostController extends FediversePostController
$this->podcast = $podcast; $this->podcast = $podcast;
$this->actor = $this->podcast->actor; $this->actor = $this->podcast->actor;
if (count($params) <= 1) {
unset($params[0]);
return $this->{$method}(...$params);
}
if ( if (
count($params) > 1 && ! ($post = (new PostModel())->getPostById($params[1])) instanceof CastopodPost
($post = (new PostModel())->getPostById($params[1])) instanceof CastopodPost
) { ) {
$this->post = $post; throw PageNotFoundException::forPageNotFound();
unset($params[0]);
unset($params[1]);
} }
$this->post = $post;
unset($params[0]);
unset($params[1]);
return $this->{$method}(...$params); return $this->{$method}(...$params);
} }
public function view(): string public function view(): string
{ {
// Prevent analytics hit when authenticated $this->registerPodcastWebpageHit($this->podcast->id);
if (! auth()->loggedIn()) {
$this->registerPodcastWebpageHit($this->podcast->id);
}
if (! $this->post instanceof CastopodPost) {
throw PageNotFoundException::forPageNotFound();
}
$cacheName = implode( $cacheName = implode(
'_', '_',
...@@ -89,10 +92,10 @@ class PostController extends FediversePostController ...@@ -89,10 +92,10 @@ class PostController extends FediversePostController
); );
if (! ($cachedView = cache($cacheName))) { if (! ($cachedView = cache($cacheName))) {
set_post_metatags($this->post);
$data = [ $data = [
'metatags' => get_post_metatags($this->post), 'post' => $this->post,
'post' => $this->post, 'podcast' => $this->podcast,
'podcast' => $this->podcast,
]; ];
// if user is logged in then send to the authenticated activity view // if user is logged in then send to the authenticated activity view
...@@ -110,7 +113,8 @@ class PostController extends FediversePostController ...@@ -110,7 +113,8 @@ class PostController extends FediversePostController
return $cachedView; return $cachedView;
} }
public function attemptCreate(): RedirectResponse #[Override]
public function createAction(): RedirectResponse
{ {
$rules = [ $rules = [
'message' => 'required|max_length[500]', 'message' => 'required|max_length[500]',
...@@ -161,7 +165,8 @@ class PostController extends FediversePostController ...@@ -161,7 +165,8 @@ class PostController extends FediversePostController
return redirect()->back(); return redirect()->back();
} }
public function attemptReply(): RedirectResponse #[Override]
public function replyAction(): RedirectResponse
{ {
$rules = [ $rules = [
'message' => 'required|max_length[500]', 'message' => 'required|max_length[500]',
...@@ -200,21 +205,23 @@ class PostController extends FediversePostController ...@@ -200,21 +205,23 @@ class PostController extends FediversePostController
return redirect()->back(); return redirect()->back();
} }
public function attemptFavourite(): RedirectResponse #[Override]
public function favouriteAction(): RedirectResponse
{ {
model('FavouriteModel')->toggleFavourite(interact_as_actor(), $this->post); model('FavouriteModel')->toggleFavourite(interact_as_actor(), $this->post);
return redirect()->back(); return redirect()->back();
} }
public function attemptReblog(): RedirectResponse #[Override]
public function reblogAction(): RedirectResponse
{ {
(new PostModel())->toggleReblog(interact_as_actor(), $this->post); (new PostModel())->toggleReblog(interact_as_actor(), $this->post);
return redirect()->back(); return redirect()->back();
} }
public function attemptAction(): RedirectResponse public function action(): RedirectResponse
{ {
$rules = [ $rules = [
'action' => 'required|in_list[favourite,reblog,reply]', 'action' => 'required|in_list[favourite,reblog,reply]',
...@@ -231,9 +238,9 @@ class PostController extends FediversePostController ...@@ -231,9 +238,9 @@ class PostController extends FediversePostController
$action = $validData['action']; $action = $validData['action'];
return match ($action) { return match ($action) {
'favourite' => $this->attemptFavourite(), 'favourite' => $this->favouriteAction(),
'reblog' => $this->attemptReblog(), 'reblog' => $this->reblogAction(),
'reply' => $this->attemptReply(), 'reply' => $this->replyAction(),
default => redirect() default => redirect()
->back() ->back()
->withInput() ->withInput()
...@@ -241,19 +248,16 @@ class PostController extends FediversePostController ...@@ -241,19 +248,16 @@ class PostController extends FediversePostController
}; };
} }
public function remoteAction(string $action): string public function remoteActionView(string $action): string
{ {
// Prevent analytics hit when authenticated $this->registerPodcastWebpageHit($this->podcast->id);
if (! auth()->loggedIn()) {
$this->registerPodcastWebpageHit($this->podcast->id);
}
set_remote_actions_metatags($this->post, $action);
$data = [ $data = [
'metatags' => get_remote_actions_metatags($this->post, $action), 'podcast' => $this->podcast,
'podcast' => $this->podcast, 'actor' => $this->actor,
'actor' => $this->actor, 'post' => $this->post,
'post' => $this->post, 'action' => $action,
'action' => $action,
]; ];
helper('form'); helper('form');
......
...@@ -21,7 +21,7 @@ class WebmanifestController extends Controller ...@@ -21,7 +21,7 @@ class WebmanifestController extends Controller
/** /**
* @var array<string, array<string, string>> * @var array<string, array<string, string>>
*/ */
final public const THEME_COLORS = [ final public const array THEME_COLORS = [
'pine' => [ 'pine' => [
'theme' => '#009486', 'theme' => '#009486',
'background' => '#F0F9F8', 'background' => '#F0F9F8',
......
...@@ -12,8 +12,11 @@ declare(strict_types=1); ...@@ -12,8 +12,11 @@ declare(strict_types=1);
namespace App\Database\Migrations; namespace App\Database\Migrations;
use Override;
class AddCategories extends BaseMigration class AddCategories extends BaseMigration
{ {
#[Override]
public function up(): void public function up(): void
{ {
$this->forge->addField([ $this->forge->addField([
...@@ -45,6 +48,7 @@ class AddCategories extends BaseMigration ...@@ -45,6 +48,7 @@ class AddCategories extends BaseMigration
$this->forge->createTable('categories'); $this->forge->createTable('categories');
} }
#[Override]
public function down(): void public function down(): void
{ {
$this->forge->dropTable('categories'); $this->forge->dropTable('categories');
......
...@@ -12,8 +12,11 @@ declare(strict_types=1); ...@@ -12,8 +12,11 @@ declare(strict_types=1);
namespace App\Database\Migrations; namespace App\Database\Migrations;
use Override;
class AddLanguages extends BaseMigration class AddLanguages extends BaseMigration
{ {
#[Override]
public function up(): void public function up(): void
{ {
$this->forge->addField([ $this->forge->addField([
...@@ -31,6 +34,7 @@ class AddLanguages extends BaseMigration ...@@ -31,6 +34,7 @@ class AddLanguages extends BaseMigration
$this->forge->createTable('languages'); $this->forge->createTable('languages');
} }
#[Override]
public function down(): void public function down(): void
{ {
$this->forge->dropTable('languages'); $this->forge->dropTable('languages');
......
...@@ -12,8 +12,11 @@ declare(strict_types=1); ...@@ -12,8 +12,11 @@ declare(strict_types=1);
namespace App\Database\Migrations; namespace App\Database\Migrations;
use Override;
class AddPodcasts extends BaseMigration class AddPodcasts extends BaseMigration
{ {
#[Override]
public function up(): void public function up(): void
{ {
$this->forge->addField([ $this->forge->addField([
...@@ -205,6 +208,7 @@ class AddPodcasts extends BaseMigration ...@@ -205,6 +208,7 @@ class AddPodcasts extends BaseMigration
$this->forge->createTable('podcasts'); $this->forge->createTable('podcasts');
} }
#[Override]
public function down(): void public function down(): void
{ {
$this->forge->dropTable('podcasts'); $this->forge->dropTable('podcasts');
......
...@@ -12,8 +12,11 @@ declare(strict_types=1); ...@@ -12,8 +12,11 @@ declare(strict_types=1);
namespace App\Database\Migrations; namespace App\Database\Migrations;
use Override;
class AddEpisodes extends BaseMigration class AddEpisodes extends BaseMigration
{ {
#[Override]
public function up(): void public function up(): void
{ {
$this->forge->addField([ $this->forge->addField([
...@@ -171,6 +174,7 @@ class AddEpisodes extends BaseMigration ...@@ -171,6 +174,7 @@ class AddEpisodes extends BaseMigration
$this->db->query($createQuery); $this->db->query($createQuery);
} }
#[Override]
public function down(): void public function down(): void
{ {
$this->forge->dropTable('episodes'); $this->forge->dropTable('episodes');
......
...@@ -12,8 +12,11 @@ declare(strict_types=1); ...@@ -12,8 +12,11 @@ declare(strict_types=1);
namespace App\Database\Migrations; namespace App\Database\Migrations;
use Override;
class AddPlatforms extends BaseMigration class AddPlatforms extends BaseMigration
{ {
#[Override]
public function up(): void public function up(): void
{ {
$this->forge->addField([ $this->forge->addField([
...@@ -41,12 +44,13 @@ class AddPlatforms extends BaseMigration ...@@ -41,12 +44,13 @@ class AddPlatforms extends BaseMigration
]); ]);
$this->forge->addField('`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP()'); $this->forge->addField('`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP()');
$this->forge->addField( $this->forge->addField(
'`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP() ON UPDATE CURRENT_TIMESTAMP()' '`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP() ON UPDATE CURRENT_TIMESTAMP()',
); );
$this->forge->addPrimaryKey('slug'); $this->forge->addPrimaryKey('slug');
$this->forge->createTable('platforms'); $this->forge->createTable('platforms');
} }
#[Override]
public function down(): void public function down(): void
{ {
$this->forge->dropTable('platforms'); $this->forge->dropTable('platforms');
......
...@@ -12,8 +12,11 @@ declare(strict_types=1); ...@@ -12,8 +12,11 @@ declare(strict_types=1);
namespace App\Database\Migrations; namespace App\Database\Migrations;
use Override;
class AddPodcastsPlatforms extends BaseMigration class AddPodcastsPlatforms extends BaseMigration
{ {
#[Override]
public function up(): void public function up(): void
{ {
$this->forge->addField([ $this->forge->addField([
...@@ -52,6 +55,7 @@ class AddPodcastsPlatforms extends BaseMigration ...@@ -52,6 +55,7 @@ class AddPodcastsPlatforms extends BaseMigration
$this->forge->createTable('podcasts_platforms'); $this->forge->createTable('podcasts_platforms');
} }
#[Override]
public function down(): void public function down(): void
{ {
$this->forge->dropTable('podcasts_platforms'); $this->forge->dropTable('podcasts_platforms');
......
...@@ -12,8 +12,11 @@ declare(strict_types=1); ...@@ -12,8 +12,11 @@ declare(strict_types=1);
namespace App\Database\Migrations; namespace App\Database\Migrations;
use Override;
class AddEpisodeComments extends BaseMigration class AddEpisodeComments extends BaseMigration
{ {
#[Override]
public function up(): void public function up(): void
{ {
$this->forge->addField([ $this->forge->addField([
...@@ -71,6 +74,7 @@ class AddEpisodeComments extends BaseMigration ...@@ -71,6 +74,7 @@ class AddEpisodeComments extends BaseMigration
$this->forge->createTable('episode_comments'); $this->forge->createTable('episode_comments');
} }
#[Override]
public function down(): void public function down(): void
{ {
$this->forge->dropTable('episode_comments'); $this->forge->dropTable('episode_comments');
......
...@@ -12,8 +12,11 @@ declare(strict_types=1); ...@@ -12,8 +12,11 @@ declare(strict_types=1);
namespace App\Database\Migrations; namespace App\Database\Migrations;
use Override;
class AddLikes extends BaseMigration class AddLikes extends BaseMigration
{ {
#[Override]
public function up(): void public function up(): void
{ {
$this->forge->addField([ $this->forge->addField([
...@@ -34,6 +37,7 @@ class AddLikes extends BaseMigration ...@@ -34,6 +37,7 @@ class AddLikes extends BaseMigration
$this->forge->createTable('likes'); $this->forge->createTable('likes');
} }
#[Override]
public function down(): void public function down(): void
{ {
$this->forge->dropTable('likes'); $this->forge->dropTable('likes');
......
...@@ -12,8 +12,11 @@ declare(strict_types=1); ...@@ -12,8 +12,11 @@ declare(strict_types=1);
namespace App\Database\Migrations; namespace App\Database\Migrations;
use Override;
class AddPages extends BaseMigration class AddPages extends BaseMigration
{ {
#[Override]
public function up(): void public function up(): void
{ {
$this->forge->addField([ $this->forge->addField([
...@@ -48,6 +51,7 @@ class AddPages extends BaseMigration ...@@ -48,6 +51,7 @@ class AddPages extends BaseMigration
$this->forge->createTable('pages'); $this->forge->createTable('pages');
} }
#[Override]
public function down(): void public function down(): void
{ {
$this->forge->dropTable('pages'); $this->forge->dropTable('pages');
......
...@@ -12,8 +12,11 @@ declare(strict_types=1); ...@@ -12,8 +12,11 @@ declare(strict_types=1);
namespace App\Database\Migrations; namespace App\Database\Migrations;
use Override;
class AddPodcastsCategories extends BaseMigration class AddPodcastsCategories extends BaseMigration
{ {
#[Override]
public function up(): void public function up(): void
{ {
$this->forge->addField([ $this->forge->addField([
...@@ -32,6 +35,7 @@ class AddPodcastsCategories extends BaseMigration ...@@ -32,6 +35,7 @@ class AddPodcastsCategories extends BaseMigration
$this->forge->createTable('podcasts_categories'); $this->forge->createTable('podcasts_categories');
} }
#[Override]
public function down(): void public function down(): void
{ {
$this->forge->dropTable('podcasts_categories'); $this->forge->dropTable('podcasts_categories');
......
...@@ -10,8 +10,11 @@ declare(strict_types=1); ...@@ -10,8 +10,11 @@ declare(strict_types=1);
namespace App\Database\Migrations; namespace App\Database\Migrations;
use Override;
class AddClips extends BaseMigration class AddClips extends BaseMigration
{ {
#[Override]
public function up(): void public function up(): void
{ {
$this->forge->addField([ $this->forge->addField([
...@@ -94,6 +97,7 @@ class AddClips extends BaseMigration ...@@ -94,6 +97,7 @@ class AddClips extends BaseMigration
$this->forge->createTable('clips'); $this->forge->createTable('clips');
} }
#[Override]
public function down(): void public function down(): void
{ {
$this->forge->dropTable('clips'); $this->forge->dropTable('clips');
......
...@@ -12,8 +12,11 @@ declare(strict_types=1); ...@@ -12,8 +12,11 @@ declare(strict_types=1);
namespace App\Database\Migrations; namespace App\Database\Migrations;
use Override;
class AddPersons extends BaseMigration class AddPersons extends BaseMigration
{ {
#[Override]
public function up(): void public function up(): void
{ {
$this->forge->addField([ $this->forge->addField([
...@@ -67,6 +70,7 @@ class AddPersons extends BaseMigration ...@@ -67,6 +70,7 @@ class AddPersons extends BaseMigration
$this->forge->createTable('persons'); $this->forge->createTable('persons');
} }
#[Override]
public function down(): void public function down(): void
{ {
$this->forge->dropTable('persons'); $this->forge->dropTable('persons');
......
...@@ -12,8 +12,11 @@ declare(strict_types=1); ...@@ -12,8 +12,11 @@ declare(strict_types=1);
namespace App\Database\Migrations; namespace App\Database\Migrations;
use Override;
class AddPodcastsPersons extends BaseMigration class AddPodcastsPersons extends BaseMigration
{ {
#[Override]
public function up(): void public function up(): void
{ {
$this->forge->addField([ $this->forge->addField([
...@@ -46,6 +49,7 @@ class AddPodcastsPersons extends BaseMigration ...@@ -46,6 +49,7 @@ class AddPodcastsPersons extends BaseMigration
$this->forge->createTable('podcasts_persons'); $this->forge->createTable('podcasts_persons');
} }
#[Override]
public function down(): void public function down(): void
{ {
$this->forge->dropTable('podcasts_persons'); $this->forge->dropTable('podcasts_persons');
......