Big commit whatever
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
class Album extends Model
|
||||
{
|
||||
protected $fillable = ['title', 'cover_path', 'release_date', 'duration_seconds', 'type', 'label_id', 'artist_id'];
|
||||
|
||||
public function label(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Label::class);
|
||||
}
|
||||
|
||||
public function artist(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Artist::class);
|
||||
}
|
||||
|
||||
public function genres(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(Genre::class, 'album_genre');
|
||||
}
|
||||
|
||||
public function tracks(): HasMany
|
||||
{
|
||||
return $this->hasMany(Track::class);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user