<?php namespace App\Models; use App\Helpers\Constants; use Illuminate\Database\Eloquent\Model; class Artist extends Model { protected $table = Constants::TABLE_ARTISTS; /** * Hàm lấy ds bài hát của 1 ca sĩ * * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany */ public function tracks() { return $this->belongsToMany( 'App\Models\Track', Constants::TABLE_TRACKS, 'artist_id', 'track_id' ); } }