mirror of
https://github.com/koel/koel
synced 2024-11-14 00:17:13 +00:00
35 lines
780 B
PHP
35 lines
780 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Traits\CanFilterByUser;
|
|
use Illuminate\Database\Eloquent\Collection;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
|
|
|
/**
|
|
* @property int $user_id
|
|
* @property Collection $songs
|
|
* @property int $id
|
|
*/
|
|
class Playlist extends Model
|
|
{
|
|
use CanFilterByUser;
|
|
|
|
protected $hidden = ['user_id', 'created_at', 'updated_at'];
|
|
protected $guarded = ['id'];
|
|
protected $casts = [
|
|
'user_id' => 'int',
|
|
];
|
|
|
|
public function songs(): BelongsToMany
|
|
{
|
|
return $this->belongsToMany(Song::class);
|
|
}
|
|
|
|
public function user(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class);
|
|
}
|
|
}
|