podcastartgenerator/site/app/Models/Episode.php

33 lines
622 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class Episode extends Model
{
use HasFactory;
use SoftDeletes;
protected $dates = ['episode_date', 'created_at', 'updated_at', 'deleted_at'];
public function podcast()
{
return $this->belongsTo(Podcast::class);
}
public function artwork()
{
return $this->hasOne(Artwork::class);
}
public function artist()
{
return $this->hasOneThrough(Artist::class, Artwork::class);
}
}