PHP Класс app\models\Song

Наследование: extends Illuminate\Database\Eloquent\Model
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$incrementing boolean Indicates if the IDs are auto-incrementing.

Защищенные свойства (Protected)

Свойство Тип Описание
$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