fix: music test apis
This commit is contained in:
@@ -4,6 +4,9 @@
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo; // ← Add this
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany; // ← Add this
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany; // ← Add this
|
||||
class Music extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
@@ -19,6 +22,9 @@ class Music extends Model
|
||||
'order' => 'integer',
|
||||
'is_active' => 'boolean',
|
||||
];
|
||||
protected $attributes = [
|
||||
'type' => 'public', // Default value
|
||||
];
|
||||
// Relation to user (optional)
|
||||
public function user()
|
||||
{
|
||||
@@ -30,7 +36,7 @@ public function playlist(): BelongsTo
|
||||
}
|
||||
public function tags(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(Tag::class, 'music_tag');
|
||||
return $this->belongsToMany(Tag::class, 'music_tags');
|
||||
}
|
||||
|
||||
protected $appends = ['url', 'image_url'];
|
||||
|
||||
Reference in New Issue
Block a user