Track.php 570 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11
<?php

namespace App\Models;

use App\Helpers\Constants;
use Illuminate\Database\Eloquent\Model;

class Track extends Model
{
    protected $table = Constants::TABLE_TRACKS;

12 13
    public $timestamps = false;

14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
    /**
     * Hàm lấy ds nghệ sĩ biểu diễn 1 bài hát
     *
     * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
     */
    public function artists()
    {
        return $this->belongsToMany(
            'App\Models\Artist',
            Constants::TABLE_ARTISTS,
            'track_id',
            'artist_id'
        );
    }

}