Pony.fm/app/Models/Playlist.php

384 lines
13 KiB
PHP
Raw Normal View History

2015-08-30 14:29:12 +02:00
<?php
/**
* Pony.fm - A community for pony fan music.
* Copyright (C) 2015 Peter Deltchev
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace Poniverse\Ponyfm\Models;
2015-08-31 14:35:47 +02:00
use DB;
2015-08-31 14:35:47 +02:00
use Helpers;
2015-08-30 14:29:12 +02:00
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Relations\MorphMany;
2015-08-30 14:29:12 +02:00
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Auth;
use Cache;
use Poniverse\Ponyfm\Contracts\Commentable;
use Poniverse\Ponyfm\Contracts\Favouritable;
use Poniverse\Ponyfm\Contracts\Searchable;
use Poniverse\Ponyfm\Exceptions\TrackFileNotFoundException;
use Poniverse\Ponyfm\Traits\IndexedInElasticsearchTrait;
use Poniverse\Ponyfm\Traits\TrackCollection;
use Poniverse\Ponyfm\Traits\SlugTrait;
use Venturecraft\Revisionable\RevisionableTrait;
2015-08-30 14:29:12 +02:00
2016-01-01 01:36:08 +01:00
/**
* Poniverse\Ponyfm\Models\Playlist
*
* @property integer $id
* @property integer $user_id
* @property string $title
* @property string $slug
* @property string $description
* @property boolean $is_public
* @property integer $track_count
* @property integer $view_count
* @property integer $download_count
* @property integer $favourite_count
* @property integer $follow_count
* @property integer $comment_count
* @property \Carbon\Carbon $created_at
* @property \Carbon\Carbon $updated_at
* @property \Carbon\Carbon $deleted_at
* @property-read \Illuminate\Database\Eloquent\Collection|\Poniverse\Ponyfm\Models\Track[] $tracks
* @property-read \Illuminate\Database\Eloquent\Collection|\Poniverse\Ponyfm\Models\ResourceUser[] $users
* @property-read \Illuminate\Database\Eloquent\Collection|\Poniverse\Ponyfm\Models\Comment[] $comments
* @property-read \Illuminate\Database\Eloquent\Collection|\Poniverse\Ponyfm\Models\PinnedPlaylist[] $pins
* @property-read \Poniverse\Ponyfm\Models\User $user
* @property-read mixed $url
* @property-read \Illuminate\Database\Eloquent\Collection|\Venturecraft\Revisionable\Revision[] $revisionHistory
* @method static \Illuminate\Database\Query\Builder|\Poniverse\Ponyfm\Models\Playlist userDetails()
* @property-read \Illuminate\Database\Eloquent\Collection|\Poniverse\Ponyfm\Models\Favourite[] $favourites
* @property-read \Illuminate\Database\Eloquent\Collection|\Poniverse\Ponyfm\Models\Activity[] $activities
2016-12-10 17:47:49 +01:00
* @method static \Illuminate\Database\Query\Builder|\Poniverse\Ponyfm\Models\Playlist whereId($value)
* @method static \Illuminate\Database\Query\Builder|\Poniverse\Ponyfm\Models\Playlist whereUserId($value)
* @method static \Illuminate\Database\Query\Builder|\Poniverse\Ponyfm\Models\Playlist whereTitle($value)
* @method static \Illuminate\Database\Query\Builder|\Poniverse\Ponyfm\Models\Playlist whereSlug($value)
* @method static \Illuminate\Database\Query\Builder|\Poniverse\Ponyfm\Models\Playlist whereDescription($value)
* @method static \Illuminate\Database\Query\Builder|\Poniverse\Ponyfm\Models\Playlist whereIsPublic($value)
* @method static \Illuminate\Database\Query\Builder|\Poniverse\Ponyfm\Models\Playlist whereTrackCount($value)
* @method static \Illuminate\Database\Query\Builder|\Poniverse\Ponyfm\Models\Playlist whereViewCount($value)
* @method static \Illuminate\Database\Query\Builder|\Poniverse\Ponyfm\Models\Playlist whereDownloadCount($value)
* @method static \Illuminate\Database\Query\Builder|\Poniverse\Ponyfm\Models\Playlist whereFavouriteCount($value)
* @method static \Illuminate\Database\Query\Builder|\Poniverse\Ponyfm\Models\Playlist whereFollowCount($value)
* @method static \Illuminate\Database\Query\Builder|\Poniverse\Ponyfm\Models\Playlist whereCommentCount($value)
* @method static \Illuminate\Database\Query\Builder|\Poniverse\Ponyfm\Models\Playlist whereCreatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\Poniverse\Ponyfm\Models\Playlist whereUpdatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\Poniverse\Ponyfm\Models\Playlist whereDeletedAt($value)
* @mixin \Eloquent
* @method static bool|null forceDelete()
* @method static \Illuminate\Database\Query\Builder|\Poniverse\Ponyfm\Models\Playlist onlyTrashed()
* @method static bool|null restore()
* @method static \Illuminate\Database\Query\Builder|\Poniverse\Ponyfm\Models\Playlist withTrashed()
* @method static \Illuminate\Database\Query\Builder|\Poniverse\Ponyfm\Models\Playlist withoutTrashed()
2016-01-01 01:36:08 +01:00
*/
class Playlist extends Model implements Searchable, Commentable, Favouritable
2015-08-30 14:29:12 +02:00
{
use SoftDeletes, SlugTrait, TrackCollection, RevisionableTrait, IndexedInElasticsearchTrait;
2015-08-30 14:29:12 +02:00
2016-01-07 19:16:37 +01:00
protected $elasticsearchType = 'playlist';
2015-08-30 14:29:12 +02:00
2016-01-07 19:16:37 +01:00
protected $table = 'playlists';
2015-08-30 14:29:12 +02:00
protected $dates = ['deleted_at'];
protected $casts = [
'id' => 'integer',
'user_id' => 'integer',
'title' => 'string',
'description' => 'string',
'is_public' => 'boolean',
'track_count' => 'integer',
'view_count' => 'integer',
'download_count' => 'integer',
'favourte_count' => 'integer',
'follow_count' => 'integer',
'comment_count' => 'integer',
];
2015-08-30 14:29:12 +02:00
public static function summary()
{
Laravel 5.2 Update (#106) * Adopt PSR-2 coding style The Laravel framework adopts the PSR-2 coding style in version 5.1. Laravel apps *should* adopt this coding style as well. Read the [PSR-2 coding style guide][1] for more details and check out [PHPCS][2] to use as a code formatting tool. [1]: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md [2]: https://github.com/squizlabs/PHP_CodeSniffer * Adopt PHP short array syntax Laravel 5 adopted the short array syntax which became available in PHP 5.4. * Remove SelfHandling from Jobs Jobs are self handling by default in Laravel 5.2. * Add new exceptions to `$dontReport` property * Shift core files * Shift Middleware Laravel 5.2 adjusts the `Guard` object used within middleware. In addition, new `can` and `throttles` middleware were added. * Shift Input to Request facade Laravel 5.2 no longer registers the `Input` facade by default. Laravel now prefers using the `Request` facade or the `$request` object within *Controllers* instead. Review the [HTTP Requests][1] documentation for more details. [1]: https://laravel.com/docs/5.2/requests * Shift configuration Laravel 5.2 introduces the `env` app configuration option and removes the `pretend` mail configuration option. In addition, a few of the default `providers` and `aliases` bindings were removed. * Shift Laravel dependencies * Shift cleanup * Updated composer.lock * Updated Middleware to 5.2 * Config update for Laravel 5.2 * [Laravel 5.2] Updated validation strings * Updated auth config * Updated to use middleware groups * Added laravel 5.2 sessions migration
2016-09-30 00:26:31 +02:00
return self::select(
'id',
'title',
'user_id',
'slug',
'created_at',
'is_public',
'description',
'comment_count',
'download_count',
'view_count',
'favourite_count',
'track_count'
);
2015-08-30 14:29:12 +02:00
}
public function scopeUserDetails($query)
{
if (Auth::check()) {
$query->with([
Laravel 5.2 Update (#106) * Adopt PSR-2 coding style The Laravel framework adopts the PSR-2 coding style in version 5.1. Laravel apps *should* adopt this coding style as well. Read the [PSR-2 coding style guide][1] for more details and check out [PHPCS][2] to use as a code formatting tool. [1]: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md [2]: https://github.com/squizlabs/PHP_CodeSniffer * Adopt PHP short array syntax Laravel 5 adopted the short array syntax which became available in PHP 5.4. * Remove SelfHandling from Jobs Jobs are self handling by default in Laravel 5.2. * Add new exceptions to `$dontReport` property * Shift core files * Shift Middleware Laravel 5.2 adjusts the `Guard` object used within middleware. In addition, new `can` and `throttles` middleware were added. * Shift Input to Request facade Laravel 5.2 no longer registers the `Input` facade by default. Laravel now prefers using the `Request` facade or the `$request` object within *Controllers* instead. Review the [HTTP Requests][1] documentation for more details. [1]: https://laravel.com/docs/5.2/requests * Shift configuration Laravel 5.2 introduces the `env` app configuration option and removes the `pretend` mail configuration option. In addition, a few of the default `providers` and `aliases` bindings were removed. * Shift Laravel dependencies * Shift cleanup * Updated composer.lock * Updated Middleware to 5.2 * Config update for Laravel 5.2 * [Laravel 5.2] Updated validation strings * Updated auth config * Updated to use middleware groups * Added laravel 5.2 sessions migration
2016-09-30 00:26:31 +02:00
'users' => function ($query) {
2015-08-30 14:29:12 +02:00
$query->whereUserId(Auth::user()->id);
}
]);
}
2017-11-28 17:44:28 +01:00
return $query;
2015-08-30 14:29:12 +02:00
}
public static function mapPublicPlaylistShow(Playlist $playlist)
2015-08-30 14:29:12 +02:00
{
$tracks = [];
foreach ($playlist->tracks as $track) {
/** @var $track Track */
2015-08-30 14:29:12 +02:00
$tracks[] = Track::mapPublicTrackSummary($track);
}
$formats = [];
foreach (Track::$Formats as $name => $format) {
if (in_array($name, Track::$LosslessFormats) && !$playlist->hasLosslessTracksOnly() && !$playlist->hasLosslessTracks()) {
continue;
}
2016-11-21 12:41:16 +01:00
2015-08-30 14:29:12 +02:00
$formats[] = [
'name' => $name,
'extension' => $format['extension'],
'url' => $playlist->getDownloadUrl($name),
'size' => Helpers::formatBytes($playlist->getFilesize($name)),
'isCacheable' => (in_array($name, Track::$CacheableFormats) ? true : false),
'isMixedLosslessness' => (in_array($name, Track::$LosslessFormats) && !$playlist->hasLosslessTracksOnly() && $playlist->hasLosslessTracks())
2015-08-30 14:29:12 +02:00
];
}
$comments = [];
foreach ($playlist->comments as $comment) {
$comments[] = Comment::mapPublic($comment);
}
$data = self::mapPublicPlaylistSummary($playlist);
$data['tracks'] = $tracks;
$data['comments'] = $comments;
$data['formats'] = $formats;
$data['share'] = [
'url' => action('PlaylistsController@getShortlink', ['id' => $playlist->id]),
'tumblrUrl' => 'http://www.tumblr.com/share/link?url='.urlencode($playlist->url).'&name='.urlencode($playlist->title).'&description='.urlencode($playlist->description),
'twitterUrl' => 'https://platform.twitter.com/widgets/tweet_button.html?text='.$playlist->title.' by '.$playlist->user->display_name.' on Pony.fm'
2015-08-30 14:29:12 +02:00
];
return $data;
}
public static function mapPublicPlaylistSummary(Playlist $playlist)
2015-08-30 14:29:12 +02:00
{
$userData = [
'stats' => [
'views' => 0,
'downloads' => 0
],
'is_favourited' => false
];
if (Auth::check() && $playlist->users->count()) {
$userRow = $playlist->users[0];
$userData = [
'stats' => [
'views' => (int) $userRow->view_count,
'downloads' => (int) $userRow->download_count,
2015-08-30 14:29:12 +02:00
],
'is_favourited' => (bool) $userRow->is_favourited
2015-08-30 14:29:12 +02:00
];
}
return [
'id' => (int) $playlist->id,
2015-08-30 14:29:12 +02:00
'track_count' => $playlist->track_count,
'title' => $playlist->title,
'slug' => $playlist->slug,
'created_at' => $playlist->created_at->format('c'),
'is_public' => (bool) $playlist->is_public,
2015-08-30 14:29:12 +02:00
'stats' => [
'views' => (int) $playlist->view_count,
'downloads' => (int) $playlist->download_count,
'comments' => (int) $playlist->comment_count,
'favourites' => (int) $playlist->favourite_count
2015-08-30 14:29:12 +02:00
],
'covers' => [
'small' => $playlist->getCoverUrl(Image::SMALL),
2015-12-13 14:42:37 +01:00
'normal' => $playlist->getCoverUrl(Image::NORMAL),
'original' => $playlist->getCoverUrl(Image::ORIGINAL)
2015-08-30 14:29:12 +02:00
],
'url' => $playlist->url,
'user' => [
'id' => (int) $playlist->user->id,
2015-08-30 14:29:12 +02:00
'name' => $playlist->user->display_name,
'url' => $playlist->user->url,
],
'user_data' => $userData,
'permissions' => [
'delete' => Auth::check() && Auth::user()->id == $playlist->user_id,
'edit' => Auth::check() && Auth::user()->id == $playlist->user_id
]
];
}
public function tracks(bool $ordered = true)
2015-08-30 14:29:12 +02:00
{
$query = $this
2016-06-06 08:15:56 +02:00
->belongsToMany(Track::class)
2015-08-30 14:29:12 +02:00
->withPivot('position')
->withTimestamps();
if ($ordered) {
$query = $query->orderBy('position', 'asc');
}
return $query;
}
public function trackCount():int
{
return $this->tracks(false)->count();
2015-08-30 14:29:12 +02:00
}
public function trackFiles()
{
$trackIds = $this->tracks->pluck('id');
return TrackFile::join('tracks', 'tracks.current_version', '=', 'track_files.version')->whereIn('track_id', $trackIds);
}
2015-08-30 14:29:12 +02:00
public function users()
{
2016-06-06 08:15:56 +02:00
return $this->hasMany(ResourceUser::class);
2015-08-30 14:29:12 +02:00
}
public function comments():HasMany
2015-08-30 14:29:12 +02:00
{
2016-06-06 08:15:56 +02:00
return $this->hasMany(Comment::class)->orderBy('created_at', 'desc');
2015-08-30 14:29:12 +02:00
}
public function pins()
{
2016-06-06 08:15:56 +02:00
return $this->hasMany(PinnedPlaylist::class);
2015-08-30 14:29:12 +02:00
}
Laravel 5.2 Update (#106) * Adopt PSR-2 coding style The Laravel framework adopts the PSR-2 coding style in version 5.1. Laravel apps *should* adopt this coding style as well. Read the [PSR-2 coding style guide][1] for more details and check out [PHPCS][2] to use as a code formatting tool. [1]: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md [2]: https://github.com/squizlabs/PHP_CodeSniffer * Adopt PHP short array syntax Laravel 5 adopted the short array syntax which became available in PHP 5.4. * Remove SelfHandling from Jobs Jobs are self handling by default in Laravel 5.2. * Add new exceptions to `$dontReport` property * Shift core files * Shift Middleware Laravel 5.2 adjusts the `Guard` object used within middleware. In addition, new `can` and `throttles` middleware were added. * Shift Input to Request facade Laravel 5.2 no longer registers the `Input` facade by default. Laravel now prefers using the `Request` facade or the `$request` object within *Controllers* instead. Review the [HTTP Requests][1] documentation for more details. [1]: https://laravel.com/docs/5.2/requests * Shift configuration Laravel 5.2 introduces the `env` app configuration option and removes the `pretend` mail configuration option. In addition, a few of the default `providers` and `aliases` bindings were removed. * Shift Laravel dependencies * Shift cleanup * Updated composer.lock * Updated Middleware to 5.2 * Config update for Laravel 5.2 * [Laravel 5.2] Updated validation strings * Updated auth config * Updated to use middleware groups * Added laravel 5.2 sessions migration
2016-09-30 00:26:31 +02:00
public function favourites():HasMany
{
return $this->hasMany(Favourite::class);
}
2015-08-30 14:29:12 +02:00
public function user()
{
2016-06-06 08:15:56 +02:00
return $this->belongsTo(User::class);
2015-08-30 14:29:12 +02:00
}
Laravel 5.2 Update (#106) * Adopt PSR-2 coding style The Laravel framework adopts the PSR-2 coding style in version 5.1. Laravel apps *should* adopt this coding style as well. Read the [PSR-2 coding style guide][1] for more details and check out [PHPCS][2] to use as a code formatting tool. [1]: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md [2]: https://github.com/squizlabs/PHP_CodeSniffer * Adopt PHP short array syntax Laravel 5 adopted the short array syntax which became available in PHP 5.4. * Remove SelfHandling from Jobs Jobs are self handling by default in Laravel 5.2. * Add new exceptions to `$dontReport` property * Shift core files * Shift Middleware Laravel 5.2 adjusts the `Guard` object used within middleware. In addition, new `can` and `throttles` middleware were added. * Shift Input to Request facade Laravel 5.2 no longer registers the `Input` facade by default. Laravel now prefers using the `Request` facade or the `$request` object within *Controllers* instead. Review the [HTTP Requests][1] documentation for more details. [1]: https://laravel.com/docs/5.2/requests * Shift configuration Laravel 5.2 introduces the `env` app configuration option and removes the `pretend` mail configuration option. In addition, a few of the default `providers` and `aliases` bindings were removed. * Shift Laravel dependencies * Shift cleanup * Updated composer.lock * Updated Middleware to 5.2 * Config update for Laravel 5.2 * [Laravel 5.2] Updated validation strings * Updated auth config * Updated to use middleware groups * Added laravel 5.2 sessions migration
2016-09-30 00:26:31 +02:00
public function activities():MorphMany
{
return $this->morphMany(Activity::class, 'resource');
}
2015-08-30 14:29:12 +02:00
public function hasPinFor($userId)
{
foreach ($this->pins as $pin) {
if ($pin->user_id == $userId) {
return true;
}
}
return false;
}
public function canView($user)
{
2016-11-21 12:41:16 +01:00
return $this->is_public || ($user != null && $user->id == $this->user_id) || ($user != null && $user->hasRole('admin'));
2015-08-30 14:29:12 +02:00
}
public function getUrlAttribute()
{
return action('PlaylistsController@getPlaylist', ['id' => $this->id, 'slug' => $this->slug]);
2015-08-30 14:29:12 +02:00
}
public function getDownloadUrl($format)
{
2015-12-26 04:00:43 +01:00
return action('PlaylistsController@getDownload', ['id' => $this->id, 'format' => Track::$Formats[$format]['extension']]);
2015-08-30 14:29:12 +02:00
}
public function getCoverUrl($type = Image::NORMAL)
{
if ($this->tracks->count() == 0) {
return $this->user->getAvatarUrl($type);
}
return $this->tracks[0]->getCoverUrl($type);
}
public function pin($userId)
{
$pin = new PinnedPlaylist();
$pin->playlist_id = $this->id;
$pin->user_id = $userId;
$pin->save();
}
private function getCacheKey($key)
{
return 'playlist-'.$this->id.'-'.$key;
2015-08-30 14:29:12 +02:00
}
2016-01-07 19:16:37 +01:00
Laravel 5.2 Update (#106) * Adopt PSR-2 coding style The Laravel framework adopts the PSR-2 coding style in version 5.1. Laravel apps *should* adopt this coding style as well. Read the [PSR-2 coding style guide][1] for more details and check out [PHPCS][2] to use as a code formatting tool. [1]: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md [2]: https://github.com/squizlabs/PHP_CodeSniffer * Adopt PHP short array syntax Laravel 5 adopted the short array syntax which became available in PHP 5.4. * Remove SelfHandling from Jobs Jobs are self handling by default in Laravel 5.2. * Add new exceptions to `$dontReport` property * Shift core files * Shift Middleware Laravel 5.2 adjusts the `Guard` object used within middleware. In addition, new `can` and `throttles` middleware were added. * Shift Input to Request facade Laravel 5.2 no longer registers the `Input` facade by default. Laravel now prefers using the `Request` facade or the `$request` object within *Controllers* instead. Review the [HTTP Requests][1] documentation for more details. [1]: https://laravel.com/docs/5.2/requests * Shift configuration Laravel 5.2 introduces the `env` app configuration option and removes the `pretend` mail configuration option. In addition, a few of the default `providers` and `aliases` bindings were removed. * Shift Laravel dependencies * Shift cleanup * Updated composer.lock * Updated Middleware to 5.2 * Config update for Laravel 5.2 * [Laravel 5.2] Updated validation strings * Updated auth config * Updated to use middleware groups * Added laravel 5.2 sessions migration
2016-09-30 00:26:31 +02:00
public function delete()
{
DB::transaction(function () {
$this->activities()->delete();
parent::delete();
});
}
2016-01-07 19:16:37 +01:00
/**
* Returns this model in Elasticsearch-friendly form. The array returned by
* this method should match the current mapping for this model's ES type.
*
* @return array
*/
Laravel 5.2 Update (#106) * Adopt PSR-2 coding style The Laravel framework adopts the PSR-2 coding style in version 5.1. Laravel apps *should* adopt this coding style as well. Read the [PSR-2 coding style guide][1] for more details and check out [PHPCS][2] to use as a code formatting tool. [1]: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md [2]: https://github.com/squizlabs/PHP_CodeSniffer * Adopt PHP short array syntax Laravel 5 adopted the short array syntax which became available in PHP 5.4. * Remove SelfHandling from Jobs Jobs are self handling by default in Laravel 5.2. * Add new exceptions to `$dontReport` property * Shift core files * Shift Middleware Laravel 5.2 adjusts the `Guard` object used within middleware. In addition, new `can` and `throttles` middleware were added. * Shift Input to Request facade Laravel 5.2 no longer registers the `Input` facade by default. Laravel now prefers using the `Request` facade or the `$request` object within *Controllers* instead. Review the [HTTP Requests][1] documentation for more details. [1]: https://laravel.com/docs/5.2/requests * Shift configuration Laravel 5.2 introduces the `env` app configuration option and removes the `pretend` mail configuration option. In addition, a few of the default `providers` and `aliases` bindings were removed. * Shift Laravel dependencies * Shift cleanup * Updated composer.lock * Updated Middleware to 5.2 * Config update for Laravel 5.2 * [Laravel 5.2] Updated validation strings * Updated auth config * Updated to use middleware groups * Added laravel 5.2 sessions migration
2016-09-30 00:26:31 +02:00
public function toElasticsearch():array
{
return [
'title' => $this->title,
'curator' => $this->user->display_name,
'tracks' => $this->tracks->pluck('title'),
];
2016-01-07 19:16:37 +01:00
}
/**
* @inheritdoc
*/
Laravel 5.2 Update (#106) * Adopt PSR-2 coding style The Laravel framework adopts the PSR-2 coding style in version 5.1. Laravel apps *should* adopt this coding style as well. Read the [PSR-2 coding style guide][1] for more details and check out [PHPCS][2] to use as a code formatting tool. [1]: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md [2]: https://github.com/squizlabs/PHP_CodeSniffer * Adopt PHP short array syntax Laravel 5 adopted the short array syntax which became available in PHP 5.4. * Remove SelfHandling from Jobs Jobs are self handling by default in Laravel 5.2. * Add new exceptions to `$dontReport` property * Shift core files * Shift Middleware Laravel 5.2 adjusts the `Guard` object used within middleware. In addition, new `can` and `throttles` middleware were added. * Shift Input to Request facade Laravel 5.2 no longer registers the `Input` facade by default. Laravel now prefers using the `Request` facade or the `$request` object within *Controllers* instead. Review the [HTTP Requests][1] documentation for more details. [1]: https://laravel.com/docs/5.2/requests * Shift configuration Laravel 5.2 introduces the `env` app configuration option and removes the `pretend` mail configuration option. In addition, a few of the default `providers` and `aliases` bindings were removed. * Shift Laravel dependencies * Shift cleanup * Updated composer.lock * Updated Middleware to 5.2 * Config update for Laravel 5.2 * [Laravel 5.2] Updated validation strings * Updated auth config * Updated to use middleware groups * Added laravel 5.2 sessions migration
2016-09-30 00:26:31 +02:00
public function shouldBeIndexed():bool
{
return $this->is_public &&
$this->track_count > 0 &&
!$this->trashed();
}
/**
* @inheritdoc
*/
Laravel 5.2 Update (#106) * Adopt PSR-2 coding style The Laravel framework adopts the PSR-2 coding style in version 5.1. Laravel apps *should* adopt this coding style as well. Read the [PSR-2 coding style guide][1] for more details and check out [PHPCS][2] to use as a code formatting tool. [1]: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md [2]: https://github.com/squizlabs/PHP_CodeSniffer * Adopt PHP short array syntax Laravel 5 adopted the short array syntax which became available in PHP 5.4. * Remove SelfHandling from Jobs Jobs are self handling by default in Laravel 5.2. * Add new exceptions to `$dontReport` property * Shift core files * Shift Middleware Laravel 5.2 adjusts the `Guard` object used within middleware. In addition, new `can` and `throttles` middleware were added. * Shift Input to Request facade Laravel 5.2 no longer registers the `Input` facade by default. Laravel now prefers using the `Request` facade or the `$request` object within *Controllers* instead. Review the [HTTP Requests][1] documentation for more details. [1]: https://laravel.com/docs/5.2/requests * Shift configuration Laravel 5.2 introduces the `env` app configuration option and removes the `pretend` mail configuration option. In addition, a few of the default `providers` and `aliases` bindings were removed. * Shift Laravel dependencies * Shift cleanup * Updated composer.lock * Updated Middleware to 5.2 * Config update for Laravel 5.2 * [Laravel 5.2] Updated validation strings * Updated auth config * Updated to use middleware groups * Added laravel 5.2 sessions migration
2016-09-30 00:26:31 +02:00
public function getResourceType():string
{
return 'playlist';
}
}