mirror of
https://github.com/koel/koel
synced 2024-11-28 06:50:27 +00:00
21 lines
493 B
PHP
21 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);
|
|
}
|
|
}
|