koel/app/Models/Playlist.php
2015-12-13 12:42:28 +08:00

29 lines
499 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use App\Traits\CanFilterByUser;
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()
{
return $this->belongsToMany(Song::class);
}
public function user()
{
return $this->belongsTo(User::class);
}
}