PHP 클래스 app\models\Song

상속: extends Illuminate\Database\Eloquent\Model
파일 보기 프로젝트 열기: phanan/koel 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$incrementing boolean Indicates if the IDs are auto-incrementing.

보호된 프로퍼티들

프로퍼티 타입 설명
$casts array
$guarded
$hidden array Here we specify to hide lyrics as well to save some bandwidth (actually, lots of it). Lyrics can then be queried on demand.

공개 메소드들

메소드 설명
album ( )
byPath ( string $path ) : Song | null Get a Song record using its path.
contributingArtist ( )
getArtistAttribute ( ) : Artist Get the correct artist of the song.
getFavorites ( User $user, boolean $toArray = false ) : Illuminate\Database\Eloquent\Collection | array Get all songs favored by a user.
getLyricsAttribute ( $value ) : string Prepare the lyrics for displaying.
getObjectStoragePublicUrl ( Aws\AwsClient $s3 = null ) : string Get the song's Object Storage url for streaming or downloading.
getRelatedYouTubeVideos ( string $youTubePageToken = '' ) : object | false Get the YouTube videos related to this song.
getS3ParamsAttribute ( ) : boolean | array Get the bucket and key name of an S3 object.
getTitleAttribute ( $value ) : string Some songs don't have a title.
isS3ObjectAttribute ( ) : boolean Determine if the song is an AWS S3 Object.
playlists ( )
scopeInDirectory ( Builder $query, string $path ) : Builder Scope a query to only include songs in a given directory.
scrobble ( string $timestamp ) : mixed Scrobble the song using Last.fm service.
setTitleAttribute ( $value ) Sometimes the tags extracted from getID3 are HTML entity encoded.
updateInfo ( array $ids, array $data ) : array Update song info.
updateSingle ( string $title, string $albumName, string $artistName, string $lyrics, integer $track, integer $compilationState ) : self Update a single song's info.

메소드 상세

album() 공개 메소드

public album ( )

byPath() 공개 정적인 메소드

Get a Song record using its path.
public static byPath ( string $path ) : Song | null
$path string
리턴 Song | null

contributingArtist() 공개 메소드

public contributingArtist ( )

getArtistAttribute() 공개 메소드

If it's part of a compilation, that would be the contributing artist. Otherwise, it's the album artist.
public getArtistAttribute ( ) : Artist
리턴 Artist

getFavorites() 공개 정적인 메소드

Get all songs favored by a user.
public static getFavorites ( User $user, boolean $toArray = false ) : Illuminate\Database\Eloquent\Collection | array
$user User
$toArray boolean
리턴 Illuminate\Database\Eloquent\Collection | array

getLyricsAttribute() 공개 메소드

Prepare the lyrics for displaying.
public getLyricsAttribute ( $value ) : string
$value
리턴 string

getObjectStoragePublicUrl() 공개 메소드

Get the song's Object Storage url for streaming or downloading.
public getObjectStoragePublicUrl ( Aws\AwsClient $s3 = null ) : string
$s3 Aws\AwsClient
리턴 string

getRelatedYouTubeVideos() 공개 메소드

Get the YouTube videos related to this song.
public getRelatedYouTubeVideos ( string $youTubePageToken = '' ) : object | false
$youTubePageToken string The YouTube page token, for pagination purpose.
리턴 object | false

getS3ParamsAttribute() 공개 메소드

Get the bucket and key name of an S3 object.
public getS3ParamsAttribute ( ) : boolean | array
리턴 boolean | array

getTitleAttribute() 공개 메소드

Fall back to the file name (without extension) for such.
public getTitleAttribute ( $value ) : string
$value
리턴 string

isS3ObjectAttribute() 공개 메소드

Determine if the song is an AWS S3 Object.
public isS3ObjectAttribute ( ) : boolean
리턴 boolean

playlists() 공개 메소드

public playlists ( )

scopeInDirectory() 공개 메소드

Scope a query to only include songs in a given directory.
public scopeInDirectory ( Builder $query, string $path ) : Builder
$query Illuminate\Database\Eloquent\Builder
$path string Full path of the directory
리턴 Illuminate\Database\Eloquent\Builder

scrobble() 공개 메소드

Scrobble the song using Last.fm service.
public scrobble ( string $timestamp ) : mixed
$timestamp string The UNIX timestamp in which the song started playing.
리턴 mixed

setTitleAttribute() 공개 메소드

This makes sure they are always sane.
public setTitleAttribute ( $value )
$value

updateInfo() 공개 정적인 메소드

Update song info.
public static updateInfo ( array $ids, array $data ) : array
$ids array
$data array The data array, with these supported fields: - title - artistName - albumName - lyrics All of these are optional, in which case the info will not be changed (except for lyrics, which will be emptied).
리턴 array

updateSingle() 공개 메소드

Update a single song's info.
public updateSingle ( string $title, string $albumName, string $artistName, string $lyrics, integer $track, integer $compilationState ) : self
$title string
$albumName string
$artistName string
$lyrics string
$track integer
$compilationState integer
리턴 self

프로퍼티 상세

$casts 보호되어 있는 프로퍼티

protected array $casts
리턴 array

$guarded 보호되어 있는 프로퍼티

protected $guarded

$hidden 보호되어 있는 프로퍼티

Here we specify to hide lyrics as well to save some bandwidth (actually, lots of it). Lyrics can then be queried on demand.
protected array $hidden
리턴 array

$incrementing 공개적으로 프로퍼티

Indicates if the IDs are auto-incrementing.
public bool $incrementing
리턴 boolean