feat(person): add podcastindex.org namespace person tag

This commit is contained in:
Benjamin Bellamy 2021-02-10 16:20:01 +00:00
commit 8acd011f13
61 changed files with 2815 additions and 101 deletions

View file

@ -16,14 +16,20 @@ use CodeIgniter\Model;
class PlatformModel extends Model
{
protected $table = 'platforms';
protected $primaryKey = 'id';
protected $primaryKey = 'slug';
protected $allowedFields = ['slug', 'label', 'home_url', 'submit_url'];
protected $allowedFields = [
'slug',
'type',
'label',
'home_url',
'submit_url',
];
protected $returnType = \App\Entities\Platform::class;
protected $useSoftDeletes = false;
protected $useTimestamps = true;
protected $useTimestamps = false;
public function getPlatforms()
{
@ -37,26 +43,32 @@ class PlatformModel extends Model
return $found;
}
public function getOrCreatePlatform($slug, $platformType)
public function getPlatform($slug)
{
if (!($found = cache("platforms_$slug"))) {
if (!($found = cache("platform_$slug"))) {
$found = $this->where('slug', $slug)->first();
if (!$found) {
$data = [
'slug' => $slug,
'type' => $platformType,
'label' => $slug,
'home_url' => '',
'submit_url' => null,
];
$this->insert($data);
$found = $this->where('slug', $slug)->first();
}
cache()->save("platforms_$slug", $found, DECADE);
cache()->save("platform_$slug", $found, DECADE);
}
return $found;
}
public function createPlatform(
$slug,
$type,
$label,
$homeUrl,
$submitUrl = null
) {
$data = [
'slug' => $slug,
'type' => $type,
'label' => $label,
'home_url' => $homeUrl,
'submit_url' => $submitUrl,
];
return $this->insert($data, false);
}
public function getPlatformsWithLinks($podcastId, $platformType)
{
if (