koel/app/Repositories/PlaylistRepository.php

22 lines
493 B
PHP
Raw Normal View History

2024-01-18 11:13:05 +00:00
<?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);
}
}