mirror of
https://github.com/ad-aures/castopod.git
synced 2026-04-16 13:07:46 +02:00
feat(episodes): replace soft delete with permanent delete
+ add constraint to prevent deleting an episode when published
This commit is contained in:
parent
0345728739
commit
eb9ff522c2
20 changed files with 242 additions and 107 deletions
|
|
@ -94,11 +94,6 @@ class EpisodeModel extends Model
|
|||
*/
|
||||
protected $returnType = Episode::class;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
protected $useSoftDeletes = true;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
|
|
@ -249,6 +244,18 @@ class EpisodeModel extends Model
|
|||
return $found;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns number of episodes of a podcast
|
||||
*/
|
||||
public function getPodcastEpisodesCount(int $podcastId): int|string
|
||||
{
|
||||
return $this
|
||||
->where([
|
||||
'podcast_id' => $podcastId,
|
||||
])
|
||||
->countAllResults();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the timestamp difference in seconds between the next episode to publish and the current timestamp Returns
|
||||
* false if there's no episode to publish
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue