se agrega relación faltante en modelo Album

Este commit está contenido en:
2025-10-16 01:48:02 -03:00
padre e8250f2cca
commit b20355ab98
Se han modificado 2 ficheros con 7 adiciones y 1 borrados

Ver fichero

@@ -4,6 +4,7 @@ namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
class Album extends Model
{
@@ -13,8 +14,13 @@ class Album extends Model
return $this->belongsTo(Artista::class, 'ArtistId');
}
public function tracks(): HasMany
{
return $this->hasMany(Track::class, 'AlbumId');
}
protected $fillable = ['AlbumId', 'Title'];
protected $fillable = ['AlbumId', 'Title', 'ArtistId'];
protected $table = 'albums'; //Si la tabla no es la esperada, definimos la variable $table con el nombre correspondiente.