mirror of
https://github.com/koel/koel
synced 2024-12-22 10:33:16 +00:00
22 lines
493 B
PHP
22 lines
493 B
PHP
|
<?php
|
||
|
|
||
|
namespace App\Repositories;
|
||
|
|
||
|
use App\Facades\License;
|
||
|
use App\Models\Playlist;
|
||
|
use App\Models\User;
|
||
|
use Illuminate\Support\Collection;
|
||
|
|
||
|
class PlaylistRepository extends Repository
|
||
|
{
|
||
|
/** @return array<array-key, Playlist>|Collection<Playlist> */
|
||
|
public function getAllAccessibleByUser(User $user): Collection
|
||
|
{
|
||
|
if (License::isCommunity()) {
|
||
|
return $user->playlists;
|
||
|
}
|
||
|
|
||
|
return $user->playlists->merge($user->collaboratedPlaylists);
|
||
|
}
|
||
|
}
|