52 lines
1.1 KiB
PHP
52 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Models\Podcast;
|
|
|
|
use App\Filters\PodcastFilter;
|
|
use App\Models\User;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Podcast extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $table = 'podcast';
|
|
public $timestamps = false;
|
|
|
|
protected $fillable = [
|
|
'url',
|
|
'title',
|
|
'creator',
|
|
'description',
|
|
'language',
|
|
'copyright',
|
|
'link',
|
|
'itunes_author',
|
|
'itunes_keywords',
|
|
'itunes_summary',
|
|
'itunes_subtitle',
|
|
'itunes_category',
|
|
'itunes_explicit',
|
|
'owner',
|
|
];
|
|
|
|
|
|
public function owner() {
|
|
return $this->belongsTo(User::class, 'owner');
|
|
}
|
|
|
|
public function episodes() {
|
|
return $this->hasMany(PodcastEpisode::class, 'podcast_id');
|
|
}
|
|
|
|
public function imported()
|
|
{
|
|
return $this->hasOne(ImportedPodcast::class, 'podcast_id');
|
|
}
|
|
|
|
public function scopeSearchFilter($query, $request) {
|
|
$filters = new PodcastFilter();
|
|
return $filters->apply($query, $request);
|
|
}
|
|
}
|