repo stringlengths 7 63 | file_url stringlengths 81 284 | file_path stringlengths 5 200 | content stringlengths 0 32.8k | language stringclasses 1 value | license stringclasses 7 values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:02:33 2026-01-05 05:24:06 | truncated bool 2 classes |
|---|---|---|---|---|---|---|---|---|
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/tests/Unit/Pipelines/Encyclopedia/GetMbidForArtistTest.php | tests/Unit/Pipelines/Encyclopedia/GetMbidForArtistTest.php | <?php
namespace Tests\Unit\Pipelines\Encyclopedia;
use App\Http\Integrations\MusicBrainz\MusicBrainzConnector;
use App\Http\Integrations\MusicBrainz\Requests\SearchForArtistRequest;
use App\Pipelines\Encyclopedia\GetMbidForArtist;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\File;
use PHPUnit\Framework\Attributes\Test;
use Saloon\Http\Faking\MockResponse;
use Saloon\Laravel\Facades\Saloon;
use Tests\Concerns\TestsPipelines;
use Tests\TestCase;
use function Tests\test_path;
class GetMbidForArtistTest extends TestCase
{
use TestsPipelines;
#[Test]
public function getMbid(): void
{
$json = File::json(test_path('fixtures/musicbrainz/artist-search.json'));
Saloon::fake([
SearchForArtistRequest::class => MockResponse::make(body: $json),
]);
$mock = self::createNextClosureMock('6da0515e-a27d-449d-84cc-00713c38a140');
(new GetMbidForArtist(new MusicBrainzConnector()))(
'Skid Row',
static fn ($args) => $mock->next($args) // @phpstan-ignore-line
);
Saloon::assertSent(static function (SearchForArtistRequest $request): bool {
self::assertSame([
'query' => 'artist:Skid Row',
'limit' => 1,
], $request->query()->all());
return true;
});
self::assertSame(
'6da0515e-a27d-449d-84cc-00713c38a140',
Cache::get(cache_key('artist mbid', 'Skid Row')),
);
}
#[Test]
public function getFromCache(): void
{
Saloon::fake([]);
Cache::put(cache_key('artist mbid', 'Skid Row'), 'sample-mbid');
$mock = self::createNextClosureMock('sample-mbid');
(new GetMbidForArtist(new MusicBrainzConnector()))(
'Skid Row',
static fn ($args) => $mock->next($args) // @phpstan-ignore-line
);
Saloon::assertNothingSent();
}
#[Test]
public function justPassOnIfMbidIsNull(): void
{
Saloon::fake([]);
$mock = self::createNextClosureMock(null);
(new GetMbidForArtist(new MusicBrainzConnector()))(
null,
static fn ($args) => $mock->next($args) // @phpstan-ignore-line
);
Saloon::assertNothingSent();
}
}
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/tests/Unit/Pipelines/Encyclopedia/GetReleaseAndReleaseGroupMbidsForAlbumTest.php | tests/Unit/Pipelines/Encyclopedia/GetReleaseAndReleaseGroupMbidsForAlbumTest.php | <?php
namespace Tests\Unit\Pipelines\Encyclopedia;
use App\Http\Integrations\MusicBrainz\MusicBrainzConnector;
use App\Http\Integrations\MusicBrainz\Requests\SearchForReleaseRequest;
use App\Pipelines\Encyclopedia\GetReleaseAndReleaseGroupMbidsForAlbum;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\File;
use PHPUnit\Framework\Attributes\Test;
use Saloon\Http\Faking\MockResponse;
use Saloon\Laravel\Facades\Saloon;
use Tests\Concerns\TestsPipelines;
use Tests\TestCase;
use function Tests\test_path;
class GetReleaseAndReleaseGroupMbidsForAlbumTest extends TestCase
{
use TestsPipelines;
#[Test]
public function getMbids(): void
{
$json = File::json(test_path('fixtures/musicbrainz/release-search.json'));
Saloon::fake([
SearchForReleaseRequest::class => MockResponse::make(body: $json),
]);
$mock = self::createNextClosureMock(['sample-release-mbid', 'sample-release-group-mbid']);
(new GetReleaseAndReleaseGroupMbidsForAlbum(new MusicBrainzConnector()))(
[
'album' => 'Slave to the Grind',
'artist' => 'Skid Row',
],
static fn ($args) => $mock->next($args) // @phpstan-ignore-line
);
Saloon::assertSent(static function (SearchForReleaseRequest $request): bool {
self::assertSame([
'query' => 'release:"Slave to the Grind" AND artist:"Skid Row"',
'limit' => 1,
], $request->query()->all());
return true;
});
self::assertSame(
['sample-release-mbid', 'sample-release-group-mbid'],
Cache::get(cache_key('release and release group mbids', 'Slave to the Grind', 'Skid Row')),
);
// The artist mbid should have been cached opportunistically, too.
self::assertSame('sample-artist-mbid', Cache::get(cache_key('artist mbid', 'Skid Row')));
}
#[Test]
public function getFromCache(): void
{
Saloon::fake([]);
Cache::put(
cache_key('release and release group mbids', 'Slave to the Grind', 'Skid Row'),
['sample-release-mbid', 'sample-release-group-mbid']
);
$mock = self::createNextClosureMock(['sample-release-mbid', 'sample-release-group-mbid']);
(new GetReleaseAndReleaseGroupMbidsForAlbum(new MusicBrainzConnector()))(
[
'album' => 'Slave to the Grind',
'artist' => 'Skid Row',
],
static fn ($args) => $mock->next($args) // @phpstan-ignore-line
);
Saloon::assertNothingSent();
}
#[Test]
public function justPassOnIfParamsAreNull(): void
{
Saloon::fake([]);
$mock = self::createNextClosureMock(null);
(new GetReleaseAndReleaseGroupMbidsForAlbum(new MusicBrainzConnector()))(
null,
static fn ($args) => $mock->next($args) // @phpstan-ignore-line
);
Saloon::assertNothingSent();
}
}
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/tests/Unit/Pipelines/Encyclopedia/GetAlbumTracksUsingMbidTest.php | tests/Unit/Pipelines/Encyclopedia/GetAlbumTracksUsingMbidTest.php | <?php
namespace Tests\Unit\Pipelines\Encyclopedia;
use App\Http\Integrations\MusicBrainz\MusicBrainzConnector;
use App\Http\Integrations\MusicBrainz\Requests\GetRecordingsRequest;
use App\Pipelines\Encyclopedia\GetAlbumTracksUsingMbid;
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\File;
use PHPUnit\Framework\Attributes\Test;
use Saloon\Http\Faking\MockResponse;
use Saloon\Laravel\Facades\Saloon;
use Tests\Concerns\TestsPipelines;
use Tests\TestCase;
use function Tests\test_path;
class GetAlbumTracksUsingMbidTest extends TestCase
{
use TestsPipelines;
private array $responseBody;
private array $tracks;
public function setUp(): void
{
parent::setUp();
$this->responseBody = File::json(test_path('fixtures/musicbrainz/recordings.json'));
$this->tracks = [];
foreach (Arr::get($this->responseBody, 'media') as $media) {
array_push($this->tracks, ...Arr::get($media, 'tracks', []));
}
}
protected function tearDown(): void
{
Cache::clear();
parent::tearDown();
}
#[Test]
public function getRecordings(): void
{
Saloon::fake([
GetRecordingsRequest::class => MockResponse::make(body: $this->responseBody),
]);
$mock = self::createNextClosureMock($this->tracks);
(new GetAlbumTracksUsingMbid(new MusicBrainzConnector()))(
'sample-mbid',
static fn ($args) => $mock->next($args) // @phpstan-ignore-line
);
Saloon::assertSent(static function (GetRecordingsRequest $request): bool {
self::assertSame(['inc' => 'recordings'], $request->query()->all());
return true;
});
self::assertEquals($this->tracks, Cache::get(cache_key('album tracks', 'sample-mbid')));
}
#[Test]
public function getFromCache(): void
{
Saloon::fake([]);
Cache::put(cache_key('album tracks', 'sample-mbid'), $this->tracks);
$mock = self::createNextClosureMock($this->tracks);
(new GetAlbumTracksUsingMbid(new MusicBrainzConnector()))(
'sample-mbid',
static fn ($args) => $mock->next($args) // @phpstan-ignore-line
);
Saloon::assertNothingSent();
}
#[Test]
public function justPassOnIfMbidIsNull(): void
{
Saloon::fake([]);
$mock = self::createNextClosureMock(null);
(new GetAlbumTracksUsingMbid(new MusicBrainzConnector()))(
null,
static fn ($args) => $mock->next($args) // @phpstan-ignore-line
);
Saloon::assertNothingSent();
}
}
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/tests/Concerns/MakesHttpRequests.php | tests/Concerns/MakesHttpRequests.php | <?php
namespace Tests\Concerns;
use App\Models\User;
use Illuminate\Testing\TestResponse;
use function Tests\create_user;
trait MakesHttpRequests
{
/**
* @param string $method
* @param string $uri
* @return TestResponse
*/
abstract public function json($method, $uri, array $data = [], array $headers = []); // @phpcs:ignore
private function jsonAs(?User $user, string $method, $uri, array $data = [], array $headers = []): TestResponse
{
$user ??= create_user();
$this->withToken($user->createToken('koel')->plainTextToken);
return $this->json($method, $uri, $data, $headers);
}
protected function getAs(string $url, ?User $user = null): TestResponse
{
return $this->jsonAs($user, 'get', $url);
}
protected function deleteAs(string $url, array $data = [], ?User $user = null): TestResponse
{
return $this->jsonAs($user, 'delete', $url, $data);
}
protected function postAs(string $url, array $data, ?User $user = null): TestResponse
{
return $this->jsonAs($user, 'post', $url, $data);
}
protected function putAs(string $url, array $data, ?User $user = null): TestResponse
{
return $this->jsonAs($user, 'put', $url, $data);
}
protected function patchAs(string $url, array $data, ?User $user = null): TestResponse
{
return $this->jsonAs($user, 'patch', $url, $data);
}
}
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/tests/Concerns/TestsPipelines.php | tests/Concerns/TestsPipelines.php | <?php
namespace Tests\Concerns;
use Mockery;
use Mockery\MockInterface;
trait TestsPipelines
{
/** @return MockInterface&object { next: callable } */
private static function createNextClosureMock(...$expectedArgs): MockInterface
{
return tap(Mockery::mock(), static fn (MockInterface $mock) => $mock->expects('next')->with(...$expectedArgs));
}
}
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/tests/Concerns/CreatesApplication.php | tests/Concerns/CreatesApplication.php | <?php
namespace Tests\Concerns;
use Illuminate\Contracts\Console\Kernel as Artisan;
use Illuminate\Foundation\Application;
use function Tests\test_path;
trait CreatesApplication
{
protected string $mediaPath;
protected string $baseUrl = 'http://localhost';
public function createApplication(): Application
{
/** @var Application $app */
$app = require __DIR__ . '/../../bootstrap/app.php';
$this->mediaPath = test_path('songs');
$artisan = $app->make(Artisan::class);
$artisan->bootstrap();
return $app;
}
}
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/tests/Concerns/AssertsArraySubset.php | tests/Concerns/AssertsArraySubset.php | <?php
namespace Tests\Concerns;
use PHPUnit\Framework\Assert;
trait AssertsArraySubset
{
public static function assertArraySubset(array $subset, array $set, ?string $message = null): void
{
if (self::isArraySubset($subset, $set)) {
Assert::assertTrue(true); // @phpstan-ignore-line
} else {
Assert::fail($message ?? 'Failed asserting that the array is a subset of another array');
}
}
private static function isArraySubset(array $subset, array $set): bool
{
foreach ($subset as $key => $value) {
if (array_key_exists($key, $set)) {
if (is_array($value)) {
if (!is_array($set[$key]) || !self::isArraySubset($value, $set[$key])) {
return false;
}
} elseif ($set[$key] !== $value) {
return false;
}
} else {
if (is_numeric($key)) {
if (!in_array($value, $set, true)) {
return false;
}
} else {
return false;
}
}
}
return true;
}
}
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/routes/channels.php | routes/channels.php | <?php
use App\Models\User;
use Illuminate\Support\Facades\Broadcast;
Broadcast::channel('user.{publicId}', static function (User $user, $publicId): bool {
return $user->is(User::query()->where('public_id', $publicId)->firstOrFail());
});
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/routes/web.base.php | routes/web.base.php | <?php
use App\Facades\ITunes;
use App\Http\Controllers\AuthorizeDropboxController;
use App\Http\Controllers\Demo\IndexController as DemoIndexController;
use App\Http\Controllers\Demo\NewSessionController;
use App\Http\Controllers\Download\DownloadAlbumController;
use App\Http\Controllers\Download\DownloadArtistController;
use App\Http\Controllers\Download\DownloadFavoritesController;
use App\Http\Controllers\Download\DownloadPlaylistController;
use App\Http\Controllers\Download\DownloadSongsController;
use App\Http\Controllers\IndexController;
use App\Http\Controllers\LastfmController;
use App\Http\Controllers\PlayController;
use App\Http\Controllers\SSO\GoogleCallbackController;
use App\Http\Controllers\StreamEmbedController;
use App\Http\Controllers\StreamRadioController;
use App\Http\Controllers\ViewSongOnITunesController;
use Illuminate\Support\Facades\Route;
use Laravel\Socialite\Facades\Socialite;
Route::middleware('web')->group(static function (): void {
// Using a closure to determine the controller instead of static configuration to allow for testing.
Route::get(
'/',
static fn () => app()->call(config('koel.misc.demo') ? DemoIndexController::class : IndexController::class),
);
Route::get('remote', static fn () => view('remote'));
Route::middleware('auth')->group(static function (): void {
Route::prefix('lastfm')->group(static function (): void {
Route::get('connect', [LastfmController::class, 'connect'])->name('lastfm.connect');
Route::get('callback', [LastfmController::class, 'callback'])->name('lastfm.callback');
});
if (ITunes::used()) {
Route::get('itunes/song/{album}', ViewSongOnITunesController::class)->name('iTunes.viewSong');
}
});
Route::get('auth/google/redirect', static fn () => Socialite::driver('google')->redirect());
Route::get('auth/google/callback', GoogleCallbackController::class);
Route::get('dropbox/authorize/{key}', AuthorizeDropboxController::class)->name('dropbox.authorize');
Route::middleware('audio.auth')->group(static function (): void {
Route::get('play/{song}/{transcode?}', PlayController::class)->name('song.play');
Route::get('radio/stream/{radioStation}', StreamRadioController::class)->name('radio.stream');
if (config('koel.download.allow')) {
Route::prefix('download')->group(static function (): void {
Route::get('songs', DownloadSongsController::class);
Route::get('album/{album}', DownloadAlbumController::class);
Route::get('artist/{artist}', DownloadArtistController::class);
Route::get('playlist/{playlist}', DownloadPlaylistController::class);
Route::get('favorites', DownloadFavoritesController::class);
});
}
});
Route::get('embeds/{embed}/stream/{song}/{options}', StreamEmbedController::class)
->name('embeds.stream')
->middleware('signed', 'throttle:10,1');
});
Route::middleware('web')->prefix('demo')->group(static function (): void {
Route::get('/new-session', NewSessionController::class)
->name('demo.new-session')
->middleware('throttle:10,1');
});
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/routes/api.base.php | routes/api.base.php | <?php
use App\Facades\YouTube;
use App\Helpers\Uuid;
use App\Http\Controllers\API\Acl\CheckResourcePermissionController;
use App\Http\Controllers\API\Acl\FetchAssignableRolesController;
use App\Http\Controllers\API\ActivateLicenseController;
use App\Http\Controllers\API\AlbumController;
use App\Http\Controllers\API\AlbumSongController;
use App\Http\Controllers\API\Artist\ArtistAlbumController;
use App\Http\Controllers\API\Artist\ArtistController;
use App\Http\Controllers\API\Artist\ArtistSongController;
use App\Http\Controllers\API\Artist\FetchArtistEventsController;
use App\Http\Controllers\API\Artist\FetchArtistInformationController;
use App\Http\Controllers\API\AuthController;
use App\Http\Controllers\API\DisconnectFromLastfmController;
use App\Http\Controllers\API\Embed\EmbedController;
use App\Http\Controllers\API\Embed\EmbedOptionsController;
use App\Http\Controllers\API\ExcerptSearchController;
use App\Http\Controllers\API\FavoriteController;
use App\Http\Controllers\API\FetchAlbumInformationController;
use App\Http\Controllers\API\FetchAlbumThumbnailController;
use App\Http\Controllers\API\FetchDemoCreditsController;
use App\Http\Controllers\API\FetchFavoriteSongsController;
use App\Http\Controllers\API\FetchInitialDataController;
use App\Http\Controllers\API\FetchOverviewController;
use App\Http\Controllers\API\FetchRecentlyPlayedSongController;
use App\Http\Controllers\API\FetchSongsForQueueController;
use App\Http\Controllers\API\FetchSongsToQueueByGenreController;
use App\Http\Controllers\API\ForgotPasswordController;
use App\Http\Controllers\API\GenreController;
use App\Http\Controllers\API\GetOneTimeTokenController;
use App\Http\Controllers\API\LambdaSongController as S3SongController;
use App\Http\Controllers\API\LikeMultipleSongsController;
use App\Http\Controllers\API\MediaBrowser\FetchFolderSongsController;
use App\Http\Controllers\API\MediaBrowser\FetchRecursiveFolderSongsController;
use App\Http\Controllers\API\MediaBrowser\FetchSubfoldersController;
use App\Http\Controllers\API\MediaBrowser\PaginateFolderSongsController;
use App\Http\Controllers\API\MovePlaylistSongsController;
use App\Http\Controllers\API\PaginateSongsByGenreController;
use App\Http\Controllers\API\PlaylistCollaboration\AcceptPlaylistCollaborationInviteController;
use App\Http\Controllers\API\PlaylistCollaboration\CreatePlaylistCollaborationTokenController;
use App\Http\Controllers\API\PlaylistCollaboration\PlaylistCollaboratorController;
use App\Http\Controllers\API\PlaylistController;
use App\Http\Controllers\API\PlaylistFolderController;
use App\Http\Controllers\API\PlaylistFolderPlaylistController;
use App\Http\Controllers\API\PlaylistSongController;
use App\Http\Controllers\API\Podcast\PodcastController;
use App\Http\Controllers\API\Podcast\PodcastEpisodeController;
use App\Http\Controllers\API\Podcast\UnsubscribeFromPodcastController;
use App\Http\Controllers\API\PrivatizeSongsController;
use App\Http\Controllers\API\ProfileController;
use App\Http\Controllers\API\PublicizeSongsController;
use App\Http\Controllers\API\QueueStateController;
use App\Http\Controllers\API\RadioStationController;
use App\Http\Controllers\API\RegisterPlayController;
use App\Http\Controllers\API\ResetPasswordController;
use App\Http\Controllers\API\ScrobbleController;
use App\Http\Controllers\API\SearchYouTubeController;
use App\Http\Controllers\API\SetLastfmSessionKeyController;
use App\Http\Controllers\API\Settings\UpdateBrandingController;
use App\Http\Controllers\API\Settings\UpdateMediaPathController;
use App\Http\Controllers\API\SongController;
use App\Http\Controllers\API\SongSearchController;
use App\Http\Controllers\API\ThemeController;
use App\Http\Controllers\API\ToggleLikeSongController;
use App\Http\Controllers\API\UnlikeMultipleSongsController;
use App\Http\Controllers\API\UpdatePlaybackStatusController;
use App\Http\Controllers\API\UpdateUserPreferenceController;
use App\Http\Controllers\API\UploadController;
use App\Http\Controllers\API\UserController;
use App\Http\Controllers\API\UserInvitationController;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
use Pusher\Pusher;
Route::prefix('api')->middleware('api')->group(static function (): void {
Route::get('ping', static fn () => null);
Route::middleware('throttle:10,1')->group(static function (): void {
Route::post('me', [AuthController::class, 'login'])->name('auth.login');
Route::post('me/otp', [AuthController::class, 'loginUsingOneTimeToken']);
Route::delete('me', [AuthController::class, 'logout']);
Route::post('forgot-password', ForgotPasswordController::class);
Route::post('reset-password', ResetPasswordController::class);
Route::get('invitations', [UserInvitationController::class, 'get']);
Route::post('invitations/accept', [UserInvitationController::class, 'accept']);
Route::get('embeds/{embed}/{options}', [EmbedController::class, 'getPayload'])->name('embeds.payload');
Route::post('embed-options', [EmbedOptionsController::class, 'encrypt']);
});
Route::middleware('auth')->group(static function (): void {
Route::get('one-time-token', GetOneTimeTokenController::class);
Route::post('broadcasting/auth', static function (Request $request) {
$pusher = new Pusher(
config('broadcasting.connections.pusher.key'),
config('broadcasting.connections.pusher.secret'),
config('broadcasting.connections.pusher.app_id'),
[
'cluster' => config('broadcasting.connections.pusher.options.cluster'),
'encrypted' => true,
]
);
return $pusher->authorizeChannel($request->input('channel_name'), $request->input('socket_id'));
})->name('broadcasting.auth');
Route::get('overview', FetchOverviewController::class);
Route::get('data', FetchInitialDataController::class);
Route::get('queue/fetch', FetchSongsForQueueController::class);
Route::put('queue/playback-status', UpdatePlaybackStatusController::class);
Route::get('queue/state', [QueueStateController::class, 'show']);
Route::put('queue/state', [QueueStateController::class, 'update']);
Route::put('settings/media-path', UpdateMediaPathController::class);
Route::put('settings/branding', UpdateBrandingController::class);
Route::apiResource('albums', AlbumController::class);
Route::apiResource('albums.songs', AlbumSongController::class);
Route::apiResource('artists', ArtistController::class);
Route::apiResource('artists.albums', ArtistAlbumController::class);
Route::apiResource('artists.songs', ArtistSongController::class);
Route::post('songs/{song}/scrobble', ScrobbleController::class)->where(['song' => Uuid::REGEX]);
Route::apiResource('songs', SongController::class)
->except('update', 'destroy')
->where(['song' => Uuid::REGEX]);
Route::put('songs', [SongController::class, 'update']);
Route::delete('songs', [SongController::class, 'destroy']);
// Fetch songs under several folder paths (may include multiple nested levels).
// This is a POST request because the folder paths may be long.
Route::post('songs/by-folders', FetchRecursiveFolderSongsController::class);
// Fetch songs **directly** in a specific folder path (or the media root if no path is specified)
Route::get('songs/in-folder', FetchFolderSongsController::class);
Route::post('upload', UploadController::class);
// Interaction routes
Route::post('interaction/play', RegisterPlayController::class);
// Like/unlike routes (deprecated)
Route::post('interaction/like', ToggleLikeSongController::class);
Route::post('interaction/batch/like', LikeMultipleSongsController::class);
Route::post('interaction/batch/unlike', UnlikeMultipleSongsController::class);
Route::post('favorites/toggle', [FavoriteController::class, 'toggle']);
Route::post('favorites', [FavoriteController::class, 'store']);
Route::delete('favorites', [FavoriteController::class, 'destroy']);
Route::get('songs/recently-played', FetchRecentlyPlayedSongController::class);
Route::get('songs/favorite', FetchFavoriteSongsController::class); // @deprecated
Route::get('songs/favorites', FetchFavoriteSongsController::class);
Route::apiResource('playlist-folders', PlaylistFolderController::class);
Route::apiResource('playlist-folders.playlists', PlaylistFolderPlaylistController::class)->except('destroy');
Route::delete(
'playlist-folders/{playlistFolder}/playlists',
[PlaylistFolderPlaylistController::class, 'destroy']
);
// Playlist routes
Route::apiResource('playlists', PlaylistController::class);
Route::apiResource('playlists.songs', PlaylistSongController::class)->except('destroy');
Route::delete('playlists/{playlist}/songs', [PlaylistSongController::class, 'destroy']);
Route::post('playlists/{playlist}/songs/move', MovePlaylistSongsController::class);
// Genre routes
Route::get('genres/{genre?}/songs', PaginateSongsByGenreController::class);
Route::get('genres/{genre?}/songs/queue', FetchSongsToQueueByGenreController::class);
Route::get('genres', [GenreController::class, 'index']);
Route::get('genres/{genre}', [GenreController::class, 'show']);
Route::apiResource('users', UserController::class)->except('show');
// User and user profile routes
Route::apiResource('user', UserController::class)->except('show');
Route::get('me', [ProfileController::class, 'show']);
Route::put('me', [ProfileController::class, 'update']);
Route::patch('me/preferences', UpdateUserPreferenceController::class);
// Last.fm-related routes
Route::post('lastfm/session-key', SetLastfmSessionKeyController::class);
Route::delete('lastfm/disconnect', DisconnectFromLastfmController::class)->name('lastfm.disconnect');
// YouTube-related routes
if (YouTube::enabled()) {
Route::get('youtube/search/song/{song}', SearchYouTubeController::class);
}
// Media information routes
Route::get('albums/{album}/information', FetchAlbumInformationController::class);
Route::get('artists/{artist}/information', FetchArtistInformationController::class);
// Events (shows) routes
Route::get('artists/{artist}/events', FetchArtistEventsController::class);
// Cover/image routes
Route::get('albums/{album}/thumbnail', FetchAlbumThumbnailController::class);
// deprecated routes
Route::get('album/{album}/thumbnail', FetchAlbumThumbnailController::class);
Route::get('search', ExcerptSearchController::class);
Route::get('search/songs', SongSearchController::class);
Route::post('invitations', [UserInvitationController::class, 'invite']);
Route::delete('invitations', [UserInvitationController::class, 'revoke']);
Route::put('songs/publicize', PublicizeSongsController::class);
Route::put('songs/privatize', PrivatizeSongsController::class);
// License routes
Route::post('licenses/activate', ActivateLicenseController::class);
// Playlist collaboration routes
Route::post('playlists/{playlist}/collaborators/invite', CreatePlaylistCollaborationTokenController::class);
Route::post('playlists/collaborators/accept', AcceptPlaylistCollaborationInviteController::class);
Route::get('playlists/{playlist}/collaborators', [PlaylistCollaboratorController::class, 'index']);
Route::delete('playlists/{playlist}/collaborators', [PlaylistCollaboratorController::class, 'destroy']);
// Podcast routes
Route::apiResource('podcasts', PodcastController::class);
Route::apiResource('podcasts.episodes', PodcastEpisodeController::class);
Route::delete('podcasts/{podcast}/subscriptions', UnsubscribeFromPodcastController::class);
// Media browser routes
Route::get('browse/folders', FetchSubfoldersController::class);
Route::get('browse/songs', PaginateFolderSongsController::class);
// Radio station routes
Route::group(['prefix' => 'radio'], static function (): void {
Route::apiResource('stations', RadioStationController::class);
});
// Theme routes
Route::apiResource('themes', ThemeController::class)->except('show', 'update');
// Embed routes
Route::post('embeds/resolve', [EmbedController::class, 'resolveForEmbeddable']);
// ACL routes
Route::group(['prefix' => 'acl'], static function (): void {
Route::get('permissions/{type}/{id}/{action}', CheckResourcePermissionController::class);
Route::get('assignable-roles', FetchAssignableRolesController::class);
});
});
// Object-storage (S3) routes
Route::middleware('os.auth')->prefix('os/s3')->group(static function (): void {
Route::post('song', [S3SongController::class, 'put'])->name('s3.song.put'); // we follow AWS's convention here.
Route::delete('song', [S3SongController::class, 'remove'])->name('s3.song.remove'); // and here.
});
Route::get('demo/credits', FetchDemoCreditsController::class);
});
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/routes/console.php | routes/console.php | <?php
use App\Jobs\RunCommandJob;
use Illuminate\Support\Facades\Schedule;
Schedule::job(new RunCommandJob('koel:scan'))->daily();
Schedule::job(new RunCommandJob('koel:prune'))->daily();
Schedule::job(new RunCommandJob('koel:podcasts:sync'))->daily();
Schedule::job(new RunCommandJob('koel:clean-up-temp-files'))->daily();
Schedule::job(new RunCommandJob('model:prune'))->daily();
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/public/index.php | public/index.php | <?php
/**
* Laravel - A PHP Framework For Web Artisans.
*
* @author Taylor Otwell <taylorotwell@gmail.com>
*/
/*
|--------------------------------------------------------------------------
| Register The Auto Loader
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader for
| our application. We just need to utilize it! We'll simply require it
| into the script here so that we don't have to worry about manual
| loading any of our classes later on. It feels nice to relax.
|
*/
use Illuminate\Contracts\Http\Kernel;
use Illuminate\Http\Request;
define('LARAVEL_START', microtime(true));
require __DIR__.'/../bootstrap/autoload.php';
/*
|--------------------------------------------------------------------------
| Turn On The Lights
|--------------------------------------------------------------------------
|
| We need to illuminate PHP development, so let us turn on the lights.
| This bootstraps the framework and gets it ready for use, then it
| will load up this application so that we can run it and send
| the responses back to the browser and delight our users.
|
*/
$app = require_once __DIR__.'/../bootstrap/app.php';
/*
|--------------------------------------------------------------------------
| Run The Application
|--------------------------------------------------------------------------
|
| Once we have the application, we can handle the incoming request
| through the kernel, and send the associated response back to
| the client's browser allowing them to enjoy the creative
| and wonderful application we have prepared for them.
|
*/
$kernel = $app->make(Kernel::class);
$response = tap($kernel->handle(
$request = Request::capture()
))->send();
$kernel->terminate($request, $response);
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/config/dotenv-editor.php | config/dotenv-editor.php | <?php
return [
/*
|----------------------------------------------------------------------
| Auto backup mode
|----------------------------------------------------------------------
|
| This value is used when you save your file content. If value is true,
| the original file will be backed up before save.
*/
'autoBackup' => true,
/*
|----------------------------------------------------------------------
| Backup location
|----------------------------------------------------------------------
|
| This value is used when you backup your file. This value is the sub
| path from root folder of project application.
*/
'backupPath' => base_path('storage/dotenv-editor/backups/'),
];
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/config/app.php | config/app.php | <?php
use App\Facades\Download;
use App\Facades\ITunes;
use App\Facades\License;
use App\Facades\Util;
use App\Facades\YouTube;
use App\Services\Dispatcher;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Blade;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Cookie;
use Illuminate\Support\Facades\Crypt;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Event;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Facades\Gate;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Lang;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Facades\Notification;
use Illuminate\Support\Facades\Password;
use Illuminate\Support\Facades\Queue;
use Illuminate\Support\Facades\Redirect;
use Illuminate\Support\Facades\Redis;
use Illuminate\Support\Facades\Request;
use Illuminate\Support\Facades\Response;
use Illuminate\Support\Facades\Route;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\Session;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Facades\URL;
use Illuminate\Support\Facades\Validator;
use Illuminate\Support\Facades\View;
use Jackiedo\DotenvEditor\Facades\DotenvEditor;
return [
'tagline' => 'Music streaming solution that works.',
'env' => env('APP_ENV', 'production'),
'name' => 'Koel',
/*
|--------------------------------------------------------------------------
| Application Debug Mode
|--------------------------------------------------------------------------
|
| When your application is in debug mode, detailed error messages with
| stack traces will be shown on every error that occurs within your
| application. If disabled, a simple generic error page is shown.
|
*/
'debug' => env('APP_DEBUG', false),
/*
|--------------------------------------------------------------------------
| Application URL
|--------------------------------------------------------------------------
|
| This URL is used by the console to properly generate URLs when using
| the Artisan command line tool. You should set this to the root of
| your application so that it is used when running Artisan tasks.
|
*/
'url' => env('APP_URL', 'http://localhost'),
/*
|--------------------------------------------------------------------------
| Trusted hosts
|--------------------------------------------------------------------------
|
| An array of (Koel server) hostnames accepted to access Koel.
| An empty array allows access to Koel with any hostname.
| Example: ['localhost', '192.168.0.1', 'yourdomain.com']
|
*/
'trusted_hosts' => explode(',', env('TRUSTED_HOSTS', '')),
/*
|--------------------------------------------------------------------------
| Application Timezone
|--------------------------------------------------------------------------
|
| Here you may specify the default timezone for your application, which
| will be used by the PHP date and date-time functions. We have gone
| ahead and set this to a sensible default for you out of the box.
|
*/
'timezone' => 'UTC',
/*
|--------------------------------------------------------------------------
| Application Locale Configuration
|--------------------------------------------------------------------------
|
| The application locale determines the default locale that will be used
| by the translation service provider. You are free to set this value
| to any of the locales which will be supported by the application.
|
*/
'locale' => 'en',
/*
|--------------------------------------------------------------------------
| Application Fallback Locale
|--------------------------------------------------------------------------
|
| The fallback locale determines the locale to use when the current one
| is not available. You may change the value to correspond to any of
| the language folders that are provided through your application.
|
*/
'fallback_locale' => 'en',
/*
|--------------------------------------------------------------------------
| Encryption Key
|--------------------------------------------------------------------------
|
| This key is used by the Illuminate encrypter service and should be set
| to a random, 32 character string, otherwise these encrypted strings
| will not be safe. Please do this before deploying an application!
|
*/
'key' => env('APP_KEY'),
'cipher' => 'AES-256-CBC',
'previous_keys' => [
...array_filter(
explode(',', env('APP_PREVIOUS_KEYS', ''))
),
],
/*
|--------------------------------------------------------------------------
| Class Aliases
|--------------------------------------------------------------------------
|
| This array of class aliases will be registered when this application
| is started. However, feel free to register as many as you wish as
| the aliases are "lazy" loaded so they don't hinder performance.
|
*/
'aliases' => [
'App' => App::class,
'Artisan' => Artisan::class,
'Auth' => Auth::class,
'Blade' => Blade::class,
'Cache' => Cache::class,
'Config' => Config::class,
'Cookie' => Cookie::class,
'Crypt' => Crypt::class,
'DB' => DB::class,
'Eloquent' => Model::class,
'Event' => Event::class,
'File' => File::class,
'Gate' => Gate::class,
'Hash' => Hash::class,
'Lang' => Lang::class,
'Log' => Log::class,
'Mail' => Mail::class,
'Notification' => Notification::class,
'Password' => Password::class,
'Queue' => Queue::class,
'Redirect' => Redirect::class,
'Redis' => Redis::class,
'Request' => Request::class,
'Response' => Response::class,
'Route' => Route::class,
'Schema' => Schema::class,
'Session' => Session::class,
'Storage' => Storage::class,
'URL' => URL::class,
'Validator' => Validator::class,
'View' => View::class,
'DotenvEditor' => DotenvEditor::class,
'Util' => Util::class,
'YouTube' => YouTube::class,
'Download' => Download::class,
'ITunes' => ITunes::class,
'License' => License::class,
'Dispatcher' => Dispatcher::class,
],
];
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/config/image.php | config/image.php | <?php
use Intervention\Image\Drivers\Gd\Driver as GdDriver;
use Intervention\Image\Drivers\Imagick\Driver as ImagickDriver;
return [
/*
|--------------------------------------------------------------------------
| Image Driver
|--------------------------------------------------------------------------
|
| Intervention Image supports "GD Library" and "Imagick" to process images
| internally. You may choose one of them according to your PHP
| configuration. By default PHP's "GD Library" implementation is used.
|
| Supported: "gd", "imagick"
|
*/
'driver' => extension_loaded('imagick')
? ImagickDriver::class
: GdDriver::class,
];
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/config/logging.php | config/logging.php | <?php
use Monolog\Handler\StreamHandler;
return [
/*
|--------------------------------------------------------------------------
| Default Log Channel
|--------------------------------------------------------------------------
|
| This option defines the default log channel that gets used when writing
| messages to the logs. The name specified in this option should match
| one of the channels defined in the "channels" configuration array.
|
*/
'default' => env('LOG_CHANNEL', 'stack'),
/*
|--------------------------------------------------------------------------
| Log Channels
|--------------------------------------------------------------------------
|
| Here you may configure the log channels for your application. Out of
| the box, Laravel uses the Monolog PHP logging library. This gives
| you a variety of powerful log handlers / formatters to utilize.
|
| Available Drivers: "single", "daily", "slack", "syslog",
| "errorlog", "monolog",
| "custom", "stack"
|
*/
'channels' => [
'stack' => [
'driver' => 'stack',
'channels' => ['single'],
],
'single' => [
'driver' => 'single',
'path' => storage_path('logs/laravel.log'),
'level' => 'debug',
],
'daily' => [
'driver' => 'daily',
'path' => storage_path('logs/laravel.log'),
'level' => 'debug',
'days' => 7,
],
'slack' => [
'driver' => 'slack',
'url' => env('LOG_SLACK_WEBHOOK_URL'),
'username' => 'Laravel Log',
'emoji' => ':boom:',
'level' => 'critical',
],
'stderr' => [
'driver' => 'monolog',
'handler' => StreamHandler::class,
'with' => [
'stream' => 'php://stderr',
],
],
'syslog' => [
'driver' => 'syslog',
'level' => 'debug',
],
'errorlog' => [
'driver' => 'errorlog',
'level' => 'debug',
],
],
];
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/config/session.php | config/session.php | <?php
return [
/*
|--------------------------------------------------------------------------
| Default Session Driver
|--------------------------------------------------------------------------
|
| This option controls the default session "driver" that will be used on
| requests. By default, we will use the lightweight native driver but
| you may specify any of the other wonderful drivers provided here.
|
| Supported: "file", "cookie", "database", "apc",
| "memcached", "redis", "array"
|
*/
'driver' => env('SESSION_DRIVER', 'file'),
/*
|--------------------------------------------------------------------------
| Session Lifetime
|--------------------------------------------------------------------------
|
| Here you may specify the number of minutes that you wish the session
| to be allowed to remain idle before it expires. If you want them
| to immediately expire on the browser closing, set that option.
|
*/
'lifetime' => 30 * 24 * 60,
'expire_on_close' => false,
/*
|--------------------------------------------------------------------------
| Session Encryption
|--------------------------------------------------------------------------
|
| This option allows you to easily specify that all of your session data
| should be encrypted before it is stored. All encryption will be run
| automatically by Laravel and you can use the Session like normal.
|
*/
'encrypt' => true,
/*
|--------------------------------------------------------------------------
| Session File Location
|--------------------------------------------------------------------------
|
| When using the native session driver, we need a location where session
| files may be stored. A default has been set for you but a different
| location may be specified. This is only needed for file sessions.
|
*/
'files' => storage_path('framework/sessions'),
/*
|--------------------------------------------------------------------------
| Session Database Connection
|--------------------------------------------------------------------------
|
| When using the "database" or "redis" session drivers, you may specify a
| connection that should be used to manage these sessions. This should
| correspond to a connection in your database configuration options.
|
*/
'connection' => null,
/*
|--------------------------------------------------------------------------
| Session Database Table
|--------------------------------------------------------------------------
|
| When using the "database" session driver, you may specify the table we
| should use to manage the sessions. Of course, a sensible default is
| provided for you; however, you are free to change this as needed.
|
*/
'table' => 'sessions',
/*
|--------------------------------------------------------------------------
| Session Sweeping Lottery
|--------------------------------------------------------------------------
|
| Some session drivers must manually sweep their storage location to get
| rid of old sessions from storage. Here are the chances that it will
| happen on a given request. By default, the odds are 2 out of 100.
|
*/
'lottery' => [2, 100],
/*
|--------------------------------------------------------------------------
| Session Cookie Name
|--------------------------------------------------------------------------
|
| Here you may change the name of the cookie used to identify a session
| instance by ID. The name specified here will get used every time a
| new session cookie is created by the framework for every driver.
|
*/
'cookie' => 'remember_me_before_the_war',
/*
|--------------------------------------------------------------------------
| Session Cookie Path
|--------------------------------------------------------------------------
|
| The session cookie path determines the path for which the cookie will
| be regarded as available. Typically, this will be the root path of
| your application but you are free to change this when necessary.
|
*/
'path' => '/',
/*
|--------------------------------------------------------------------------
| Session Cookie Domain
|--------------------------------------------------------------------------
|
| Here you may change the domain of the cookie used to identify a session
| in your application. This will determine which domains the cookie is
| available to in your application. A sensible default has been set.
|
*/
'domain' => null,
/*
|--------------------------------------------------------------------------
| HTTPS Only Cookies
|--------------------------------------------------------------------------
|
| By setting this option to true, session cookies will only be sent back
| to the server if the browser has a HTTPS connection. This will keep
| the cookie from being sent to you if it can not be done securely.
|
*/
'secure' => false,
];
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/config/queue.php | config/queue.php | <?php
return [
/*
|--------------------------------------------------------------------------
| Default Queue Connection Name
|--------------------------------------------------------------------------
|
| Laravel's queue supports a variety of backends via a single, unified
| API, giving you convenient access to each backend using identical
| syntax for each. The default queue connection is defined below.
|
*/
'default' => env('QUEUE_CONNECTION', 'database'),
/*
|--------------------------------------------------------------------------
| Queue Connections
|--------------------------------------------------------------------------
|
| Here you may configure the connection options for every queue backend
| used by your application. An example configuration is provided for
| each backend supported by Laravel. You're also free to add more.
|
| Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null"
|
*/
'connections' => [
'sync' => [
'driver' => 'sync',
],
'database' => [
'driver' => 'database',
'connection' => env('DB_QUEUE_CONNECTION'),
'table' => env('DB_QUEUE_TABLE', 'jobs'),
'queue' => env('DB_QUEUE', 'default'),
'retry_after' => (int) env('DB_QUEUE_RETRY_AFTER', 90),
'after_commit' => false,
],
'beanstalkd' => [
'driver' => 'beanstalkd',
'host' => env('BEANSTALKD_QUEUE_HOST', 'localhost'),
'queue' => env('BEANSTALKD_QUEUE', 'default'),
'retry_after' => (int) env('BEANSTALKD_QUEUE_RETRY_AFTER', 90),
'block_for' => 0,
'after_commit' => false,
],
'sqs' => [
'driver' => 'sqs',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'),
'queue' => env('SQS_QUEUE', 'default'),
'suffix' => env('SQS_SUFFIX'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
'after_commit' => false,
],
'redis' => [
'driver' => 'redis',
'connection' => env('REDIS_QUEUE_CONNECTION', 'default'),
'queue' => env('REDIS_QUEUE', 'default'),
'retry_after' => (int) env('REDIS_QUEUE_RETRY_AFTER', 90),
'block_for' => null,
'after_commit' => false,
],
],
/*
|--------------------------------------------------------------------------
| Job Batching
|--------------------------------------------------------------------------
|
| The following options configure the database and table that store job
| batching information. These options can be updated to any database
| connection and table which has been defined by your application.
|
*/
'batching' => [
'database' => env('DB_CONNECTION', 'sqlite'),
'table' => 'job_batches',
],
/*
|--------------------------------------------------------------------------
| Failed Queue Jobs
|--------------------------------------------------------------------------
|
| These options configure the behavior of failed queue job logging so you
| can control how and where failed jobs are stored. Laravel ships with
| support for storing failed jobs in a simple file or in a database.
|
| Supported drivers: "database-uuids", "dynamodb", "file", "null"
|
*/
'failed' => [
'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'),
'database' => env('DB_CONNECTION', 'sqlite'),
'table' => 'failed_jobs',
],
];
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/config/saloon.php | config/saloon.php | <?php
declare(strict_types=1);
use Saloon\Http\Senders\GuzzleSender;
return [
/*
|--------------------------------------------------------------------------
| Default Saloon Sender
|--------------------------------------------------------------------------
|
| This value specifies the "sender" class that Saloon should use by
| default on all connectors. You can change this sender if you
| would like to use your own. You may also specify your own
| sender on a per-connector basis.
|
*/
'default_sender' => GuzzleSender::class,
/*
|--------------------------------------------------------------------------
| Integrations Path
|--------------------------------------------------------------------------
|
| By default, this package will create any classes within
| `/app/Http/Integrations` directory. If you're using
| a different design approach, then your classes
| may be in a different place. You can change
| that location so that the saloon:list
| command will still find your files
|
*/
'integrations_path' => base_path('App/Http/Integrations'),
];
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/config/cache.php | config/cache.php | <?php
return [
/*
|--------------------------------------------------------------------------
| Default Cache Store
|--------------------------------------------------------------------------
|
| This option controls the default cache connection that gets used while
| using this caching library. This connection is used when another is
| not explicitly specified when executing a given caching function.
|
*/
'default' => env('CACHE_DRIVER', 'file'),
/*
|--------------------------------------------------------------------------
| Cache Stores
|--------------------------------------------------------------------------
|
| Here you may define all of the cache "stores" for your application as
| well as their drivers. You may even define multiple stores for the
| same cache driver to group types of items stored in your caches.
|
*/
'stores' => [
'apc' => [
'driver' => 'apc',
],
'array' => [
'driver' => 'array',
],
'database' => [
'driver' => 'database',
'table' => 'cache',
'connection' => null,
],
'file' => [
'driver' => 'file',
'path' => storage_path('framework/cache/data'),
],
'memcached' => [
'driver' => 'memcached',
'servers' => [
[
'host' => '127.0.0.1', 'port' => 11211, 'weight' => 100,
],
],
],
'redis' => [
'driver' => 'redis',
'connection' => 'default',
],
],
/*
|--------------------------------------------------------------------------
| Cache Key Prefix
|--------------------------------------------------------------------------
|
| When utilizing a RAM based store such as APC or Memcached, there might
| be other applications utilizing the same cache. So, we'll specify a
| value to get prefixed to all our keys so we can avoid collisions.
|
*/
'prefix' => 'laravel',
];
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/config/hashing.php | config/hashing.php | <?php
return [
/*
|--------------------------------------------------------------------------
| Default Hash Driver
|--------------------------------------------------------------------------
|
| This option controls the default hash driver that will be used to hash
| passwords for your application. By default, the bcrypt algorithm is
| used; however, you remain free to modify this option if you wish.
|
| Supported: "bcrypt", "argon"
|
*/
'driver' => 'bcrypt',
/*
|--------------------------------------------------------------------------
| Bcrypt Options
|--------------------------------------------------------------------------
|
| Here you may specify the configuration options that should be used when
| passwords are hashed using the Bcrypt algorithm. This will allow you
| to control the amount of time it takes to hash the given password.
|
*/
'bcrypt' => [
'rounds' => env('BCRYPT_ROUNDS', 10),
],
/*
|--------------------------------------------------------------------------
| Argon Options
|--------------------------------------------------------------------------
|
| Here you may specify the configuration options that should be used when
| passwords are hashed using the Argon algorithm. These will allow you
| to control the amount of time it takes to hash the given password.
|
*/
'argon' => [
'memory' => 1024,
'threads' => 2,
'time' => 2,
],
];
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/config/view.php | config/view.php | <?php
return [
/*
|--------------------------------------------------------------------------
| View Storage Paths
|--------------------------------------------------------------------------
|
| Most templating systems load templates from disk. Here you may specify
| an array of paths that should be checked for your views. Of course
| the usual Laravel view path has already been registered for you.
|
*/
'paths' => [
realpath(base_path('resources/views')),
],
/*
|--------------------------------------------------------------------------
| Compiled View Path
|--------------------------------------------------------------------------
|
| This option determines where all the compiled Blade templates will be
| stored for your application. Typically, this is within the storage
| directory. However, as usual, you are free to change this value.
|
*/
'compiled' => realpath(storage_path('framework/views')),
];
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/config/database.php | config/database.php | <?php
use Illuminate\Support\Str;
return [
/*
|--------------------------------------------------------------------------
| Default Database Connection Name
|--------------------------------------------------------------------------
|
| Here you may specify which of the database connections below you wish
| to use as your default connection for all database work. Of course
| you may use many connections at once using the Database library.
|
*/
'default' => env('DB_CONNECTION', 'mysql'),
/*
|--------------------------------------------------------------------------
| Database Connections
|--------------------------------------------------------------------------
|
| Here are each of the database connections setup for your application.
| Of course, examples of configuring each database platform that is
| supported by Laravel is shown below to make development simple.
|
|
| All database work in Laravel is done through the PHP PDO facilities
| so make sure you have the driver for your particular database of
| choice installed on your machine before you begin development.
|
*/
'connections' => [
'sqlite' => [
'driver' => 'sqlite',
'database' => ':memory:',
'prefix' => '',
],
'sqlite-e2e' => [
'driver' => 'sqlite',
'database' => env('DB_DATABASE', __DIR__ . '/../database/e2e.sqlite'),
'prefix' => '',
],
'sqlite-persistent' => [
'driver' => 'sqlite',
'database' => env('DB_DATABASE', __DIR__ . '/../database/koel.sqlite'),
'prefix' => '',
],
'mysql' => [
'driver' => 'mysql',
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', 3306),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'prefix_indexes' => true,
'strict' => false, // setting this to true will cause IncreaseStringColumnsLength migration to fail
'engine' => null,
'options' => extension_loaded('pdo_mysql') ? array_filter([
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
]) : [],
],
'mariadb' => [
'driver' => 'mariadb',
'url' => env('DB_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'laravel'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => env('DB_CHARSET', 'utf8mb4'),
'collation' => env('DB_COLLATION', 'utf8mb4_unicode_ci'),
'prefix' => '',
'prefix_indexes' => true,
'strict' => false,
'engine' => null,
'options' => extension_loaded('pdo_mysql') ? array_filter([
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
]) : [],
],
'pgsql' => [
'driver' => 'pgsql',
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '5432'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'prefix' => '',
'prefix_indexes' => true,
'search_path' => 'public',
'sslmode' => 'prefer',
],
'mysql-ci' => [
'driver' => 'mysql',
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', 3306),
'database' => env('DB_DATABASE', 'koel'),
'username' => env('DB_USERNAME', 'mysql'),
'password' => env('DB_PASSWORD', 'mysql'),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'prefix_indexes' => true,
'strict' => false,
'engine' => null,
],
'pgsql-ci' => [
'driver' => 'pgsql',
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', 5432),
'database' => env('DB_DATABASE', 'koel'),
'username' => env('DB_USERNAME', 'postgres'),
'password' => env('DB_PASSWORD', 'postgres'),
'charset' => 'utf8',
'prefix' => '',
'schema' => 'public',
],
'sqlsrv' => [
'driver' => 'sqlsrv',
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', '1433'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'prefix' => '',
'prefix_indexes' => true,
],
],
/*
|--------------------------------------------------------------------------
| Migration Repository Table
|--------------------------------------------------------------------------
|
| This table keeps track of all the migrations that have already run for
| your application. Using this information, we can determine which of
| the migrations on disk haven't actually been run in the database.
|
*/
'migrations' => 'migrations',
/*
|--------------------------------------------------------------------------
| Redis Databases
|--------------------------------------------------------------------------
|
| Redis is an open source, fast, and advanced key-value store that also
| provides a richer set of commands than a typical key-value systems
| such as APC or Memcached. Laravel makes it easy to dig right in.
|
*/
'redis' => [
'client' => env('REDIS_CLIENT', 'phpredis'),
'options' => [
'cluster' => env('REDIS_CLUSTER', 'redis'),
'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'koel'), '_') . '_database_'),
],
'default' => [
'url' => env('REDIS_URL'),
'host' => env('REDIS_HOST', '127.0.0.1'),
'username' => env('REDIS_USERNAME'),
'password' => env('REDIS_PASSWORD'),
'port' => env('REDIS_PORT', '6379'),
'database' => env('REDIS_DB', '0'),
],
'cache' => [
'url' => env('REDIS_URL'),
'host' => env('REDIS_HOST', '127.0.0.1'),
'username' => env('REDIS_USERNAME'),
'password' => env('REDIS_PASSWORD'),
'port' => env('REDIS_PORT', '6379'),
'database' => env('REDIS_CACHE_DB', '1'),
],
],
];
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/config/audit.php | config/audit.php | <?php
use OwenIt\Auditing\Models\Audit;
use OwenIt\Auditing\Resolvers\IpAddressResolver;
use OwenIt\Auditing\Resolvers\UrlResolver;
use OwenIt\Auditing\Resolvers\UserAgentResolver;
use OwenIt\Auditing\Resolvers\UserResolver;
return [
'enabled' => env('AUDITING_ENABLED', true),
/*
|--------------------------------------------------------------------------
| Audit Implementation
|--------------------------------------------------------------------------
|
| Define which Audit model implementation should be used.
|
*/
'implementation' => Audit::class,
/*
|--------------------------------------------------------------------------
| User Morph prefix & Guards
|--------------------------------------------------------------------------
|
| Define the morph prefix and authentication guards for the User resolver.
|
*/
'user' => [
'morph_prefix' => 'user',
'guards' => [
'web',
'api',
],
'resolver' => UserResolver::class,
],
/*
|--------------------------------------------------------------------------
| Audit Resolvers
|--------------------------------------------------------------------------
|
| Define the IP Address, User Agent and URL resolver implementations.
|
*/
'resolvers' => [
'ip_address' => IpAddressResolver::class,
'user_agent' => UserAgentResolver::class,
'url' => UrlResolver::class,
],
/*
|--------------------------------------------------------------------------
| Audit Events
|--------------------------------------------------------------------------
|
| The Eloquent events that trigger an Audit.
|
*/
'events' => [
'created',
'updated',
'deleted',
'restored',
],
/*
|--------------------------------------------------------------------------
| Strict Mode
|--------------------------------------------------------------------------
|
| Enable the strict mode when auditing?
|
*/
'strict' => false,
/*
|--------------------------------------------------------------------------
| Global exclude
|--------------------------------------------------------------------------
|
| Have something you always want to exclude by default? - add it here.
| Note that this is overwritten (not merged) with local exclude
|
*/
'exclude' => [],
/*
|--------------------------------------------------------------------------
| Empty Values
|--------------------------------------------------------------------------
|
| Should Audit records be stored when the recorded old_values & new_values
| are both empty?
|
| Some events may be empty on purpose. Use allowed_empty_values to exclude
| those from the empty values check. For example when auditing
| model retrieved events which will never have new and old values.
|
|
*/
'empty_values' => true,
'allowed_empty_values' => [
'retrieved',
],
/*
|--------------------------------------------------------------------------
| Allowed Array Values
|--------------------------------------------------------------------------
|
| Should the array values be audited?
|
| By default, array values are not allowed. This is to prevent performance
| issues when storing large amounts of data. You can override this by
| setting allow_array_values to true.
*/
'allowed_array_values' => false,
/*
|--------------------------------------------------------------------------
| Audit Timestamps
|--------------------------------------------------------------------------
|
| Should the created_at, updated_at and deleted_at timestamps be audited?
|
*/
'timestamps' => false,
/*
|--------------------------------------------------------------------------
| Audit Threshold
|--------------------------------------------------------------------------
|
| Specify a threshold for the number of Audit records a model can have.
| Zero means no limit.
|
*/
'threshold' => 0,
/*
|--------------------------------------------------------------------------
| Audit Driver
|--------------------------------------------------------------------------
|
| The default audit driver used to keep track of changes.
|
*/
'driver' => 'database',
/*
|--------------------------------------------------------------------------
| Audit Driver Configurations
|--------------------------------------------------------------------------
|
| Available audit drivers and respective configurations.
|
*/
'drivers' => [
'database' => [
'table' => 'audits',
'connection' => null,
],
],
/*
|--------------------------------------------------------------------------
| Audit Queue Configurations
|--------------------------------------------------------------------------
|
| Available audit queue configurations.
|
*/
'queue' => [
'enable' => false,
'connection' => 'sync',
'queue' => 'default',
'delay' => 0,
],
/*
|--------------------------------------------------------------------------
| Audit Console
|--------------------------------------------------------------------------
|
| Whether console events should be audited (eg. php artisan db:seed).
|
*/
'console' => false,
];
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/config/services.php | config/services.php | <?php
use App\Models\User;
return [
/*
|--------------------------------------------------------------------------
| Third Party Services
|--------------------------------------------------------------------------
|
| This file is for storing the credentials for third party services such
| as Stripe, Mailgun, Mandrill, and others. This file provides a sane
| default location for this type of information, allowing packages
| to have a conventional place to find your various credentials.
|
*/
'mailgun' => [
'domain' => env('MAILGUN_DOMAIN'),
'secret' => env('MAILGUN_SECRET'),
],
'mandrill' => [
'secret' => env('MANDRILL_SECRET'),
],
'ses' => [
'key' => env('SES_KEY'),
'secret' => env('SES_SECRET'),
'region' => 'us-east-1',
],
'stripe' => [
'model' => User::class,
'key' => env('STRIPE_KEY'),
'secret' => env('STRIPE_SECRET'),
],
'google' => [
'client_id' => env('SSO_GOOGLE_CLIENT_ID'),
'client_secret' => env('SSO_GOOGLE_CLIENT_SECRET'),
'redirect' => '/auth/google/callback',
'hd' => env('SSO_GOOGLE_HOSTED_DOMAIN'),
],
'gravatar' => [
'url' => env('GRAVATAR_URL', 'https://www.gravatar.com/avatar'),
'default' => env('GRAVATAR_DEFAULT', 'robohash'),
],
];
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/config/permission.php | config/permission.php | <?php
use Spatie\Permission\DefaultTeamResolver;
use Spatie\Permission\Models\Permission;
use Spatie\Permission\Models\Role;
return [
'models' => [
/*
* When using the "HasPermissions" trait from this package, we need to know which
* Eloquent model should be used to retrieve your permissions. Of course, it
* is often just the "Permission" model but you may use whatever you like.
*
* The model you want to use as a Permission model needs to implement the
* `Spatie\Permission\Contracts\Permission` contract.
*/
'permission' => Permission::class,
/*
* When using the "HasRoles" trait from this package, we need to know which
* Eloquent model should be used to retrieve your roles. Of course, it
* is often just the "Role" model but you may use whatever you like.
*
* The model you want to use as a Role model needs to implement the
* `Spatie\Permission\Contracts\Role` contract.
*/
'role' => Role::class,
],
'table_names' => [
/*
* When using the "HasRoles" trait from this package, we need to know which
* table should be used to retrieve your roles. We have chosen a basic
* default value but you may easily change it to any table you like.
*/
'roles' => 'roles',
/*
* When using the "HasPermissions" trait from this package, we need to know which
* table should be used to retrieve your permissions. We have chosen a basic
* default value but you may easily change it to any table you like.
*/
'permissions' => 'permissions',
/*
* When using the "HasPermissions" trait from this package, we need to know which
* table should be used to retrieve your models permissions. We have chosen a
* basic default value but you may easily change it to any table you like.
*/
'model_has_permissions' => 'model_has_permissions',
/*
* When using the "HasRoles" trait from this package, we need to know which
* table should be used to retrieve your models roles. We have chosen a
* basic default value but you may easily change it to any table you like.
*/
'model_has_roles' => 'model_has_roles',
/*
* When using the "HasRoles" trait from this package, we need to know which
* table should be used to retrieve your roles permissions. We have chosen a
* basic default value but you may easily change it to any table you like.
*/
'role_has_permissions' => 'role_has_permissions',
],
'column_names' => [
/*
* Change this if you want to name the related pivots other than defaults
*/
'role_pivot_key' => null, // default 'role_id',
'permission_pivot_key' => null, // default 'permission_id',
/*
* Change this if you want to name the related model primary key other than
* `model_id`.
*
* For example, this would be nice if your primary keys are all UUIDs. In
* that case, name this `model_uuid`.
*/
'model_morph_key' => 'model_id',
/*
* Change this if you want to use the teams feature and your related model's
* foreign key is other than `team_id`.
*/
'team_foreign_key' => 'team_id',
],
/*
* When set to true, the method for checking permissions will be registered on the gate.
* Set this to false if you want to implement custom logic for checking permissions.
*/
'register_permission_check_method' => true,
/*
* When set to true, Laravel\Octane\Events\OperationTerminated event listener will be registered
* this will refresh permissions on every TickTerminated, TaskTerminated and RequestTerminated
* NOTE: This should not be needed in most cases, but an Octane/Vapor combination benefited from it.
*/
'register_octane_reset_listener' => false,
/*
* Events will fire when a role or permission is assigned/unassigned:
* \Spatie\Permission\Events\RoleAttached
* \Spatie\Permission\Events\RoleDetached
* \Spatie\Permission\Events\PermissionAttached
* \Spatie\Permission\Events\PermissionDetached
*
* To enable, set to true, and then create listeners to watch these events.
*/
'events_enabled' => false,
/*
* Teams Feature.
* When set to true the package implements teams using the 'team_foreign_key'.
* If you want the migrations to register the 'team_foreign_key', you must
* set this to true before doing the migration.
* If you already did the migration then you must make a new migration to also
* add 'team_foreign_key' to 'roles', 'model_has_roles', and 'model_has_permissions'
* (view the latest version of this package's migration file)
*/
'teams' => false,
/*
* The class to use to resolve the permissions team id
*/
'team_resolver' => DefaultTeamResolver::class,
/*
* Passport Client Credentials Grant
* When set to true the package will use Passports Client to check permissions
*/
'use_passport_client_credentials' => false,
/*
* When set to true, the required permission names are added to exception messages.
* This could be considered an information leak in some contexts, so the default
* setting is false here for optimum safety.
*/
'display_permission_in_exception' => false,
/*
* When set to true, the required role names are added to exception messages.
* This could be considered an information leak in some contexts, so the default
* setting is false here for optimum safety.
*/
'display_role_in_exception' => false,
/*
* By default wildcard permission lookups are disabled.
* See documentation to understand supported syntax.
*/
'enable_wildcard_permission' => false,
/*
* The class to use for interpreting wildcard permissions.
* If you need to modify delimiters, override the class and specify its name here.
*/
// 'wildcard_permission' => Spatie\Permission\WildcardPermission::class,
/* Cache-specific settings */
'cache' => [
/*
* By default all permissions are cached for 24 hours to speed up performance.
* When permissions or roles are updated the cache is flushed automatically.
*/
'expiration_time' => DateInterval::createFromDateString('24 hours'),
/*
* The cache key used to store all permissions.
*/
'key' => 'spatie.permission.cache',
/*
* You may optionally indicate a specific cache driver to use for permission and
* role caching using any of the `store` drivers listed in the cache.php config
* file. Using 'default' here means to use the `default` set in cache.php.
*/
'store' => 'default',
],
];
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/config/filesystems.php | config/filesystems.php | <?php
return [
/*
|--------------------------------------------------------------------------
| Default Filesystem Disk
|--------------------------------------------------------------------------
|
| Here you may specify the default filesystem disk that should be used
| by the framework. A "local" driver, as well as a variety of cloud
| based drivers are available for your choosing. Just store away!
|
| Supported: "local", "ftp", "s3", "rackspace"
|
*/
'default' => 'local',
/*
|--------------------------------------------------------------------------
| Default Cloud Filesystem Disk
|--------------------------------------------------------------------------
|
| Many applications store files both locally and in the cloud. For this
| reason, you may specify a default "cloud" driver here. This driver
| will be bound as the Cloud disk implementation in the container.
|
*/
'cloud' => 's3',
/*
|--------------------------------------------------------------------------
| Filesystem Disks
|--------------------------------------------------------------------------
|
| Here you may configure as many filesystem "disks" as you wish, and you
| may even configure multiple disks of the same driver. Defaults have
| been setup for each driver as an example of the required options.
|
*/
'disks' => [
'local' => [
'driver' => 'local',
'root' => storage_path('app'),
'throw' => true,
],
'ftp' => [
'driver' => 'ftp',
'host' => 'ftp.example.com',
'username' => 'your-username',
'password' => 'your-password',
// Optional FTP Settings...
// 'port' => 21,
// 'root' => '',
// 'passive' => true,
// 'ssl' => true,
// 'timeout' => 30,
'throw' => true,
],
's3' => [
'driver' => 's3',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_REGION', 'us-east-1'),
'bucket' => env('AWS_BUCKET'),
'url' => env('AWS_URL'),
'endpoint' => env('AWS_ENDPOINT'),
'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false),
'throw' => true,
],
'dropbox' => [
'driver' => 'dropbox',
'app_key' => env('DROPBOX_APP_KEY', ''),
'app_secret' => env('DROPBOX_APP_SECRET', ''),
'refresh_token' => env('DROPBOX_REFRESH_TOKEN', ''),
],
'sftp' => [
'driver' => 'sftp',
'host' => env('SFTP_HOST', ''),
'root' => rtrim(env('SFTP_ROOT') ?? '', '/\\'),
'username' => env('SFTP_USERNAME', ''),
'password' => env('SFTP_PASSWORD', ''),
'privateKey' => env('SFTP_PRIVATE_KEY'),
'passphrase' => env('SFTP_PASSPHRASE'),
'throw' => true,
],
'rackspace' => [
'driver' => 'rackspace',
'username' => 'your-username',
'key' => 'your-key',
'container' => 'your-container',
'endpoint' => 'https://identity.api.rackspacecloud.com/v2.0/',
'region' => 'IAD',
'url_type' => 'publicURL',
],
],
];
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/config/lemonsqueezy.php | config/lemonsqueezy.php | <?php
return [
'store_id' => 62685,
'product_id' => env('PLUS_PRODUCT_ID', '58e8adbc-b1aa-43f9-b768-a52d1d8e6a40'),
];
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/config/mail.php | config/mail.php | <?php
return [
/*
|--------------------------------------------------------------------------
| Default Mailer
|--------------------------------------------------------------------------
|
| This option controls the default mailer that is used to send any email
| messages sent by your application. Alternative mailers may be setup
| and used as needed; however, this mailer will be used by default.
|
*/
'default' => env('MAIL_MAILER', 'smtp'),
/*
|--------------------------------------------------------------------------
| Mailer Configurations
|--------------------------------------------------------------------------
|
| Here you may configure all of the mailers used by your application plus
| their respective settings. Several examples have been configured for
| you and you are free to add your own as your application requires.
|
| Laravel supports a variety of mail "transport" drivers to be used while
| sending an e-mail. You will specify which one you are using for your
| mailers below. You are free to add additional mailers as required.
|
| Supported: "smtp", "sendmail", "mailgun", "ses",
| "postmark", "log", "array", "failover"
|
*/
'mailers' => [
'smtp' => [
'transport' => 'smtp',
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
'port' => env('MAIL_PORT', 587),
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
'timeout' => null,
'local_domain' => env('MAIL_EHLO_DOMAIN'),
],
'ses' => [
'transport' => 'ses',
],
'mailgun' => [
'transport' => 'mailgun',
],
'postmark' => [
'transport' => 'postmark',
],
'sendmail' => [
'transport' => 'sendmail',
'path' => env('MAIL_SENDMAIL_PATH', '/usr/sbin/sendmail -bs -i'),
],
'log' => [
'transport' => 'log',
'channel' => env('MAIL_LOG_CHANNEL'),
],
'array' => [
'transport' => 'array',
],
'failover' => [
'transport' => 'failover',
'mailers' => [
'smtp',
'log',
],
],
],
/*
|--------------------------------------------------------------------------
| Global "From" Address
|--------------------------------------------------------------------------
|
| You may wish for all e-mails sent by your application to be sent from
| the same address. Here, you may specify a name and address that is
| used globally for all e-mails that are sent by your application.
|
*/
'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
'name' => env('MAIL_FROM_NAME', 'Example'),
],
/*
|--------------------------------------------------------------------------
| Markdown Mail Settings
|--------------------------------------------------------------------------
|
| If you are using Markdown based email rendering, you may configure your
| theme and component paths here, allowing you to customize the design
| of the emails. Or, you may simply stick with the Laravel defaults!
|
*/
'markdown' => [
'theme' => 'default',
'paths' => [
resource_path('views/vendor/mail'),
],
],
];
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/config/ignition.php | config/ignition.php | <?php
use Facade\Ignition\SolutionProviders\MissingPackageSolutionProvider;
return [
/*
|--------------------------------------------------------------------------
| Editor
|--------------------------------------------------------------------------
|
| Choose your preferred editor to use when clicking any edit button.
|
| Supported: "phpstorm", "vscode", "vscode-insiders",
| "sublime", "atom"
|
*/
'editor' => env('IGNITION_EDITOR', 'phpstorm'),
/*
|--------------------------------------------------------------------------
| Theme
|--------------------------------------------------------------------------
|
| Here you may specify which theme Ignition should use.
|
| Supported: "light", "dark", "auto"
|
*/
'theme' => env('IGNITION_THEME', 'dark'),
/*
|--------------------------------------------------------------------------
| Sharing
|--------------------------------------------------------------------------
|
| You can share local errors with colleagues or others around the world.
| Sharing is completely free and doesn't require an account on Flare.
|
| If necessary, you can completely disable sharing below.
|
*/
'enable_share_button' => env('IGNITION_SHARING_ENABLED', false),
/*
|--------------------------------------------------------------------------
| Register Ignition commands
|--------------------------------------------------------------------------
|
| Ignition comes with an additional make command that lets you create
| new solution classes more easily. To keep your default Laravel
| installation clean, this command is not registered by default.
|
| You can enable the command registration below.
|
*/
'register_commands' => env('REGISTER_IGNITION_COMMANDS', false),
/*
|--------------------------------------------------------------------------
| Ignored Solution Providers
|--------------------------------------------------------------------------
|
| You may specify a list of solution providers (as fully qualified class
| names) that shouldn't be loaded. Ignition will ignore these classes
| and possible solutions provided by them will never be displayed.
|
*/
'ignored_solution_providers' => [
MissingPackageSolutionProvider::class,
],
/*
|--------------------------------------------------------------------------
| Runnable Solutions
|--------------------------------------------------------------------------
|
| Some solutions that Ignition displays are runnable and can perform
| various tasks. Runnable solutions are enabled when your app has
| debug mode enabled. You may also fully disable this feature.
|
*/
'enable_runnable_solutions' => env('IGNITION_ENABLE_RUNNABLE_SOLUTIONS', null),
/*
|--------------------------------------------------------------------------
| Remote Path Mapping
|--------------------------------------------------------------------------
|
| If you are using a remote dev server, like Laravel Homestead, Docker, or
| even a remote VPS, it will be necessary to specify your path mapping.
|
| Leaving one, or both of these, empty or null will not trigger the remote
| URL changes and Ignition will treat your editor links as local files.
|
| "remote_sites_path" is an absolute base path for your sites or projects
| in Homestead, Vagrant, Docker, or another remote development server.
|
| Example value: "/home/vagrant/Code"
|
| "local_sites_path" is an absolute base path for your sites or projects
| on your local computer where your IDE or code editor is running on.
|
| Example values: "/Users/<name>/Code", "C:\Users\<name>\Documents\Code"
|
*/
'remote_sites_path' => env('IGNITION_REMOTE_SITES_PATH', ''),
'local_sites_path' => env('IGNITION_LOCAL_SITES_PATH', ''),
/*
|--------------------------------------------------------------------------
| Housekeeping Endpoint Prefix
|--------------------------------------------------------------------------
|
| Ignition registers a couple of routes when it is enabled. Below you may
| specify a route prefix that will be used to host all internal links.
|
*/
'housekeeping_endpoint_prefix' => '_ignition',
];
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/config/ide-helper.php | config/ide-helper.php | <?php
return [
/*
|--------------------------------------------------------------------------
| Filename & Format
|--------------------------------------------------------------------------
|
| The default filename (without extension) and the format (php or json)
|
*/
'filename' => '_ide_helper',
'format' => 'php',
/*
|--------------------------------------------------------------------------
| Helper files to include
|--------------------------------------------------------------------------
|
| Include helper files. By default not included, but can be toggled with the
| -- helpers (-H) option. Extra helper files can be included.
|
*/
'include_helpers' => false,
'helper_files' => [
base_path() . '/vendor/laravel/framework/src/Illuminate/Support/Helpers.php',
],
/*
|--------------------------------------------------------------------------
| Model locations to include
|--------------------------------------------------------------------------
|
| Define in which directories the ide-helper:models command should look
| for models.
|
*/
'model_locations' => [
'app',
],
/*
|--------------------------------------------------------------------------
| Extra classes
|--------------------------------------------------------------------------
|
| These implementations are not really extended, but called with magic functions
|
*/
'extra' => [
'Eloquent' => ['Illuminate\Database\Eloquent\Builder', 'Illuminate\Database\Query\Builder'],
'Session' => ['Illuminate\Session\Store'],
],
'magic' => [
'Log' => [
'debug' => 'Monolog\Logger::addDebug',
'info' => 'Monolog\Logger::addInfo',
'notice' => 'Monolog\Logger::addNotice',
'warning' => 'Monolog\Logger::addWarning',
'error' => 'Monolog\Logger::addError',
'critical' => 'Monolog\Logger::addCritical',
'alert' => 'Monolog\Logger::addAlert',
'emergency' => 'Monolog\Logger::addEmergency',
],
],
/*
|--------------------------------------------------------------------------
| Interface implementations
|--------------------------------------------------------------------------
|
| These interfaces will be replaced with the implementing class. Some interfaces
| are detected by the helpers, others can be listed below.
|
*/
'interfaces' => [
],
/*
|--------------------------------------------------------------------------
| Support for custom DB types
|--------------------------------------------------------------------------
|
| This setting allow you to map any custom database type (that you may have
| created using CREATE TYPE statement or imported using database plugin
| / extension to a Doctrine type.
|
| Each key in this array is a name of the Doctrine2 DBAL Platform. Currently valid names are:
| 'postgresql', 'db2', 'drizzle', 'mysql', 'oracle', 'sqlanywhere', 'sqlite', 'mssql'
|
| This name is returned by getName() method of the specific Doctrine/DBAL/Platforms/AbstractPlatform descendant
|
| The value of the array is an array of type mappings. Key is the name of the custom type,
| (for example, "jsonb" from Postgres 9.4) and the value is the name of the corresponding Doctrine2 type (in
| our case it is 'json_array'. Doctrine types are listed here:
| http://doctrine-dbal.readthedocs.org/en/latest/reference/types.html
|
| So to support jsonb in your models when working with Postgres, just add the following entry to the array below:
|
| "postgresql" => array(
| "jsonb" => "json_array",
| ),
|
*/
'custom_db_types' => [
],
];
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/config/koel.php | config/koel.php | <?php
return [
'storage_driver' => env('STORAGE_DRIVER', 'local') ?: 'local',
'media_path' => env('MEDIA_PATH'),
// The absolute path to the directory to store artifacts, such as the transcoded audio files
// or downloaded podcast episodes. By default, it is set to the system's temporary directory.
'artifacts_path' => env('ARTIFACTS_PATH') ?: sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'koel',
// The *relative* path to the directory to store artist images, playlist covers, user avatars, etc.
// This is relative to the public path.
'image_storage_dir' => 'img/storage/',
/*
|--------------------------------------------------------------------------
| Sync Options
|--------------------------------------------------------------------------
|
| A timeout is set when using the browser to scan the folder path
|
*/
'scan' => [
'timeout' => env('APP_MAX_SCAN_TIME', 600),
'memory_limit' => env('MEMORY_LIMIT'),
],
/*
|--------------------------------------------------------------------------
| Streaming Configurations
|--------------------------------------------------------------------------
|
| Many streaming options can be set, including, 'bitrate' with 128 set
| as the default, 'method' with php as the default and 'transcoding'
| to configure the path for FFMPEG to transcode FLAC audio files
|
*/
'streaming' => [
'bitrate' => env('TRANSCODE_BIT_RATE') ?: env('OUTPUT_BIT_RATE', 128),
'method' => env('STREAMING_METHOD'),
'ffmpeg_path' => env('FFMPEG_PATH') ?: find_ffmpeg_path(),
'transcode_flac' => env('TRANSCODE_FLAC', true),
'supported_mime_types' => [
// Lossy formats
'audio/mpeg' => 'mp3', // MP3
'audio/mp4' => ['mp4', 'm4a'], // AAC, M4A (MP4 audio)
'audio/aac' => ['aac'], // AAC
'audio/ogg' => 'ogg', // Ogg (Vorbis, Opus, Speex, FLAC)
'audio/vorbis' => 'ogg', // Ogg Vorbis
'audio/opus' => 'opus', // Opus
'audio/flac' => ['flac', 'fla'], // FLAC
'audio/x-flac' => ['flac', 'fla'], // FLAC (alternate)
'audio/amr' => 'amr', // AMR
'audio/ac3' => 'ac3', // Dolby AC-3
'audio/dts' => 'dts', // DTS
'audio/vnd.rn-realaudio' => ['ra', 'rm'], // RealAudio
'audio/x-ms-wma' => 'wma', // Windows Media Audio (WMA)
'audio/basic' => 'au', // µ-law
// Lossless and other audio formats
'audio/vnd.wave' => 'wav', // WAV
'audio/x-wav' => 'wav', // WAV (alternate)
'audio/aiff' => ['aif', 'aiff', 'aifc'], // AIFF
'audio/x-aiff' => ['aif', 'aiff', 'aifc'], // AIFF (alternate)
'audio/x-m4a' => 'mp4', // Apple MPEG-4 Audio
'audio/x-matroska' => 'mka', // Matroska Audio
'audio/webm' => 'webm', // WebM Audio
'audio/x-ape' => 'ape', // Monkey’s Audio (APE)
'audio/tta' => 'tta', // True Audio (TTA)
'audio/x-wavpack' => ['wv', 'wvc'], // WavPack
'audio/x-optimfrog' => ['ofr', 'ofs'], // OptimFROG
'audio/x-shorten' => 'shn', // Shorten
'audio/x-lpac' => 'lpac', // LPAC
'audio/x-dsd' => ['dsf', 'dff'] , // DSD (DSF)
'audio/x-speex' => 'spx', // Speex
'audio/x-dss' => 'dss', // DSS (Digital Speech Standard)
'audio/x-audible' => 'aa', // Audible
'audio/x-twinvq' => 'vqf', // TwinVQ
'audio/vqf' => 'vqf', // TwinVQ (alternate)
'audio/x-musepack' => ['mpc', 'mp+'], // Musepack
'audio/x-monkeys-audio' => 'ape',// APE (alternate)
'audio/x-voc' => 'voc', // Creative VOC
],
// Note that this is **not** guaranteed to work 100% of the time, as technically
// a mime type doesn't tell the actual codec used in the file.
// However, it's a good enough heuristic for most cases.
'transcode_required_mime_types' => [
'audio/vorbis',
'audio/x-flac',
'audio/amr',
'audio/ac3',
'audio/dts',
'audio/vnd.rn-realaudio',
'audio/x-ms-wma',
'audio/basic',
'audio/vnd.wave', // not always handled correctly
'audio/aiff',
'audio/x-aiff',
'audio/x-m4a', // only if it contains ALAC (not AAC)
'audio/x-matroska',
'audio/x-ape',
'audio/tta',
'audio/x-wavpack',
'audio/x-optimfrog',
'audio/x-shorten',
'audio/x-lpac',
'audio/x-dsd',
'audio/x-speex',
'audio/x-dss',
'audio/x-audible',
'audio/x-twinvq',
'audio/vqf',
'audio/x-musepack',
'audio/x-monkeys-audio',
'audio/x-voc',
],
],
'services' => [
'musicbrainz' => [
'enabled' => env('USE_MUSICBRAINZ', true),
'endpoint' => 'https://musicbrainz.org/ws/2',
'user_agent' => env('MUSICBRAINZ_USER_AGENT'),
],
'youtube' => [
'key' => env('YOUTUBE_API_KEY'),
'endpoint' => 'https://www.googleapis.com/youtube/v3',
],
'lastfm' => [
'key' => env('LASTFM_API_KEY'),
'secret' => env('LASTFM_API_SECRET'),
'endpoint' => 'https://ws.audioscrobbler.com/2.0',
],
'spotify' => [
'client_id' => env('SPOTIFY_CLIENT_ID'),
'client_secret' => env('SPOTIFY_CLIENT_SECRET'),
],
'itunes' => [
'enabled' => env('USE_ITUNES', true),
'affiliate_id' => '1000lsGu',
'endpoint' => 'https://itunes.apple.com/search',
],
'ticketmaster' => [
'key' => env('TICKETMASTER_API_KEY'),
'endpoint' => 'https://app.ticketmaster.com/discovery/v2',
'default_country_code' => env('TICKETMASTER_DEFAULT_COUNTRY_CODE') ?: 'US',
],
'ipinfo' => [
'token' => env('IPINFO_TOKEN'),
'endpoint' => 'https://api.ipinfo.io',
],
],
'cdn' => [
'url' => env('CDN_URL'),
],
/*
|--------------------------------------------------------------------------
| Downloading Music
|--------------------------------------------------------------------------
|
| Koel provides the ability to prohibit or allow [default] downloading music
|
*/
'download' => [
'allow' => env('ALLOW_DOWNLOAD', true),
],
'media_browser' => [
'enabled' => env('MEDIA_BROWSER_ENABLED', false),
],
/*
|--------------------------------------------------------------------------
| Ignore Dot Files
|--------------------------------------------------------------------------
|
| Ignore dot files and folders when scanning for media files.
|
*/
'ignore_dot_files' => env('IGNORE_DOT_FILES', true),
'force_https' => env('FORCE_HTTPS', false),
'backup_on_delete' => env('BACKUP_ON_DELETE', true),
'sync_log_level' => env('SYNC_LOG_LEVEL', 'error'),
'proxy_auth' => [
'enabled' => env('PROXY_AUTH_ENABLED', false),
'user_header' => env('PROXY_AUTH_USER_HEADER', 'remote-user'),
'preferred_name_header' => env('PROXY_AUTH_PREFERRED_NAME_HEADER', 'remote-preferred-name'),
'allow_list' => array_map(static fn ($entry) => trim($entry), explode(',', env('PROXY_AUTH_ALLOW_LIST', ''))),
],
'misc' => [
'home_url' => 'https://koel.dev',
'docs_url' => 'https://docs.koel.dev',
'sponsor_github_url' => 'https://github.com/users/phanan/sponsorship',
'sponsor_open_collective_url' => 'https://opencollective.com/koel',
'demo' => env('KOEL_DEMO', false),
],
];
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/config/compile.php | config/compile.php | <?php
return [
/*
|--------------------------------------------------------------------------
| Additional Compiled Classes
|--------------------------------------------------------------------------
|
| Here you may specify additional classes to include in the compiled file
| generated by the `artisan optimize` command. These should be classes
| that are included on basically every request into the application.
|
*/
'files' => [
],
/*
|--------------------------------------------------------------------------
| Compiled File Providers
|--------------------------------------------------------------------------
|
| Here you may list service providers which define a "compiles" function
| that returns additional files that should be compiled, providing an
| easy way to get common files from any packages you are utilizing.
|
*/
'providers' => [
],
];
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/config/scout.php | config/scout.php | <?php
return [
/*
|--------------------------------------------------------------------------
| Default Search Engine
|--------------------------------------------------------------------------
|
| This option controls the default search connection that gets used while
| using Laravel Scout. This connection is used when syncing all models
| to the search service. You should adjust this based on your needs.
|
| Supported: "algolia", "null"
|
*/
'driver' => env('SCOUT_DRIVER', 'tntsearch'),
/*
|--------------------------------------------------------------------------
| Index Prefix
|--------------------------------------------------------------------------
|
| Here you may specify a prefix that will be applied to all search index
| names used by Scout. This prefix may be useful if you have multiple
| "tenants" or applications sharing the same search infrastructure.
|
*/
'prefix' => env('SCOUT_PREFIX', ''),
/*
|--------------------------------------------------------------------------
| Queue Data Syncing
|--------------------------------------------------------------------------
|
| This option allows you to control if the operations that sync your data
| with your search engines are queued. When this is set to "true" then
| all automatic data syncing will get queued for better performance.
|
*/
'queue' => env('SCOUT_QUEUE', false),
/*
|--------------------------------------------------------------------------
| Chunk Sizes
|--------------------------------------------------------------------------
|
| These options allow you to control the maximum chunk size when you are
| mass importing data into the search engine. This allows you to fine
| tune each of these chunk sizes based on the power of the servers.
|
*/
'chunk' => [
'searchable' => 500,
'unsearchable' => 500,
],
/*
|--------------------------------------------------------------------------
| Soft Deletes
|--------------------------------------------------------------------------
|
| This option allows to control whether to keep soft deleted records in
| the search indexes. Maintaining soft deleted records can be useful
| if your application still needs to search for the records later.
|
*/
'soft_delete' => false,
/*
|--------------------------------------------------------------------------
| Identify User
|--------------------------------------------------------------------------
|
| This option allows you to control whether to notify the search engine
| of the user performing the search. This is sometimes useful if the
| engine supports any analytics based on this application's users.
|
| Supported engines: "algolia"
|
*/
'identify' => env('SCOUT_IDENTIFY', false),
/*
|--------------------------------------------------------------------------
| Algolia Configuration
|--------------------------------------------------------------------------
|
| Here you may configure your Algolia settings. Algolia is a cloud hosted
| search engine which works great with Scout out of the box. Just plug
| in your application ID and admin API key to get started searching.
|
*/
'algolia' => [
'id' => env('ALGOLIA_APP_ID', ''),
'secret' => env('ALGOLIA_SECRET', ''),
],
'tntsearch' => [
'storage' => storage_path('search-indexes'),
'fuzziness' => env('TNTSEARCH_FUZZINESS', true),
'fuzzy' => [
'prefix_length' => 2,
'max_expansions' => 50,
'distance' => 2,
],
'asYouType' => false,
'searchBoolean' => env('TNTSEARCH_BOOLEAN', false),
],
];
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/config/broadcasting.php | config/broadcasting.php | <?php
return [
/*
|--------------------------------------------------------------------------
| Default Broadcaster
|--------------------------------------------------------------------------
|
| This option controls the default broadcaster that will be used by the
| framework when an event needs to be broadcast. You may set this to
| any of the connections defined in the "connections" array below.
|
| Supported: "reverb", "pusher", "ably", "redis", "log", "null"
|
*/
'default' => env('BROADCAST_CONNECTION', 'null'),
/*
|--------------------------------------------------------------------------
| Broadcast Connections
|--------------------------------------------------------------------------
|
| Here you may define all of the broadcast connections that will be used
| to broadcast events to other systems or over WebSockets. Samples of
| each available type of connection are provided inside this array.
|
*/
'connections' => [
'reverb' => [
'driver' => 'reverb',
'key' => env('REVERB_APP_KEY'),
'secret' => env('REVERB_APP_SECRET'),
'app_id' => env('REVERB_APP_ID'),
'options' => [
'host' => env('REVERB_HOST'),
'port' => env('REVERB_PORT', 443),
'scheme' => env('REVERB_SCHEME', 'https'),
'useTLS' => env('REVERB_SCHEME', 'https') === 'https',
],
'client_options' => [
// Guzzle client options: https://docs.guzzlephp.org/en/stable/request-options.html
],
],
'pusher' => [
'driver' => 'pusher',
'key' => env('PUSHER_APP_KEY'),
'secret' => env('PUSHER_APP_SECRET'),
'app_id' => env('PUSHER_APP_ID'),
'options' => [
'cluster' => env('PUSHER_APP_CLUSTER'),
'host' => env('PUSHER_HOST') ?: 'api-' . env('PUSHER_APP_CLUSTER', 'mt1') . '.pusher.com',
'port' => env('PUSHER_PORT', 443),
'scheme' => env('PUSHER_SCHEME', 'https'),
'encrypted' => true,
'useTLS' => env('PUSHER_SCHEME', 'https') === 'https',
],
'client_options' => [
// Guzzle client options: https://docs.guzzlephp.org/en/stable/request-options.html
],
],
'ably' => [
'driver' => 'ably',
'key' => env('ABLY_KEY'),
],
'log' => [
'driver' => 'log',
],
'null' => [
'driver' => 'null',
],
],
];
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/config/auth.php | config/auth.php | <?php
use App\Models\User;
return [
/*
|--------------------------------------------------------------------------
| Authentication Defaults
|--------------------------------------------------------------------------
|
| This option controls the default authentication "guard" and password
| reset options for your application. You may change these defaults
| as required, but they're a perfect start for most applications.
|
*/
'defaults' => [
'guard' => 'api',
'passwords' => 'users',
],
/*
|--------------------------------------------------------------------------
| Authentication Guards
|--------------------------------------------------------------------------
|
| Next, you may define every authentication guard for your application.
| Of course, a great default configuration has been defined for you
| here which uses session storage and the Eloquent user provider.
|
| All authentication drivers have a user provider. This defines how the
| users are actually retrieved out of your database or other storage
| mechanisms used by this application to persist your user's data.
|
| Supported: "session", "token"
|
*/
'guards' => [
'web' => [
'driver' => 'token-via-query-parameter',
'provider' => 'users',
],
'api' => [
'driver' => 'sanctum',
'provider' => 'users',
],
],
/*
|--------------------------------------------------------------------------
| User Providers
|--------------------------------------------------------------------------
|
| All authentication drivers have a user provider. This defines how the
| users are actually retrieved out of your database or other storage
| mechanisms used by this application to persist your user's data.
|
| If you have multiple user tables or models you may configure multiple
| sources which represent each model / table. These sources may then
| be assigned to any extra authentication guards you have defined.
|
| Supported: "database", "eloquent"
|
*/
'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => User::class,
],
// 'users' => [
// 'driver' => 'database',
// 'table' => 'users',
// ],
],
/*
|--------------------------------------------------------------------------
| Resetting Passwords
|--------------------------------------------------------------------------
|
| Here you may set the options for resetting passwords including the view
| that is your password reset e-mail. You may also set the name of the
| table that maintains all of the reset tokens for your application.
|
| You may specify multiple password reset configurations if you have more
| than one user table or model in the application and you want to have
| separate password reset settings based on the specific user types.
|
| The expire time is the number of minutes that the reset token should be
| considered valid. This security feature keeps tokens short-lived so
| they have less time to be guessed. You may change this as needed.
|
*/
'passwords' => [
'users' => [
'provider' => 'users',
'email' => 'auth.emails.password',
'table' => 'password_resets',
'expire' => 60,
],
],
];
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/config/sanctum.php | config/sanctum.php | <?php
return [
/*
|--------------------------------------------------------------------------
| Stateful Domains
|--------------------------------------------------------------------------
|
| Requests from the following domains / hosts will receive stateful API
| authentication cookies. Typically, these should include your local
| and production domains which access your API via a frontend SPA.
|
*/
'stateful' => [],
/*
|--------------------------------------------------------------------------
| Expiration Minutes
|--------------------------------------------------------------------------
|
| This value controls the number of minutes until an issued token will be
| considered expired. If this value is null, personal access tokens do
| not expire. This won't tweak the lifetime of first-party sessions.
|
*/
'expiration' => null,
/*
|--------------------------------------------------------------------------
| Sanctum Middleware
|--------------------------------------------------------------------------
|
| When authenticating your first-party SPA with Sanctum you may need to
| customize some of the middleware Sanctum uses while processing the
| request. You may change the middleware listed below as required.
|
*/
'middleware' => [
],
];
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/database/factories/SongFactory.php | database/factories/SongFactory.php | <?php
namespace Database\Factories;
use App\Models\Album;
use App\Models\Podcast;
use Illuminate\Database\Eloquent\Factories\Factory;
use PhanAn\Poddle\Values\EpisodeMetadata;
class SongFactory extends Factory
{
/** @inheritdoc */
public function definition(): array
{
return [
'album_id' => Album::factory(),
'album_name' => static fn (array $attributes) => Album::query()->find($attributes['album_id'])?->name, // @phpstan-ignore-line
'artist_id' => static fn (array $attributes) => Album::query()->find($attributes['album_id'])?->artist_id, // @phpstan-ignore-line
'artist_name' => static fn (array $attributes) => Album::query()->find($attributes['album_id'])?->artist_name, // @phpstan-ignore-line
'title' => $this->faker->sentence,
'length' => $this->faker->randomFloat(2, 10, 500),
'track' => random_int(1, 20),
'disc' => random_int(1, 5),
'lyrics' => $this->faker->paragraph(),
'path' => '/tmp/' . uniqid('', true) . '.mp3',
'year' => $this->faker->year(),
'is_public' => true,
'owner_id' => static fn (array $attributes) => Album::query()->find($attributes['album_id'])->user_id, // @phpstan-ignore-line
'hash' => $this->faker->md5(),
'mtime' => time(),
'mime_type' => 'audio/mpeg',
'file_size' => $this->faker->numberBetween(4_000_000, 10_000_000),
];
}
public function public(): self
{
return $this->state(fn () => ['is_public' => true]); // @phpcs:ignore
}
public function private(): self
{
return $this->state(fn () => ['is_public' => false]); // @phpcs:ignore
}
public function asEpisode(): self
{
return $this->state(fn () => [ // @phpcs:ignore
'podcast_id' => Podcast::factory(),
'episode_metadata' => EpisodeMetadata::fromArray([
'link' => $this->faker->url(),
'description' => $this->faker->paragraph,
'duration' => $this->faker->randomFloat(2, 10, 500),
'image' => $this->faker->imageUrl(),
]),
'is_public' => true,
'artist_id' => null,
'owner_id' => null,
'album_id' => null,
'storage' => null,
'path' => $this->faker->url(),
'lyrics' => '',
'track' => null,
'disc' => 0,
'year' => null,
'mime_type' => null,
'file_size' => null,
]);
}
}
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/database/factories/PlaylistCollaborationTokenFactory.php | database/factories/PlaylistCollaborationTokenFactory.php | <?php
namespace Database\Factories;
use App\Models\Playlist;
use Illuminate\Database\Eloquent\Factories\Factory;
class PlaylistCollaborationTokenFactory extends Factory
{
/** @inheritdoc */
public function definition(): array
{
return [
'playlist_id' => Playlist::factory(),
];
}
}
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/database/factories/RadioStationFactory.php | database/factories/RadioStationFactory.php | <?php
namespace Database\Factories;
use App\Helpers\Ulid;
use App\Models\RadioStation;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends Factory<RadioStation>
*/
class RadioStationFactory extends Factory
{
/**
* @inheritdoc
*/
public function definition(): array
{
return [
'user_id' => User::factory(),
'name' => $this->faker->company(),
'url' => $this->faker->url(),
'logo' => Ulid::generate() . '.webp',
'description' => $this->faker->text(),
'is_public' => false,
];
}
}
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/database/factories/ArtistFactory.php | database/factories/ArtistFactory.php | <?php
namespace Database\Factories;
use App\Helpers\Ulid;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
class ArtistFactory extends Factory
{
/** @inheritdoc */
public function definition(): array
{
return [
'user_id' => User::factory(),
'name' => $this->faker->name,
'image' => Ulid::generate() . '.jpg',
];
}
}
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/database/factories/PlaylistFolderFactory.php | database/factories/PlaylistFolderFactory.php | <?php
namespace Database\Factories;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
class PlaylistFolderFactory extends Factory
{
/** @inheritdoc */
public function definition(): array
{
return [
'user_id' => User::factory(),
'name' => $this->faker->name,
];
}
}
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/database/factories/PodcastFactory.php | database/factories/PodcastFactory.php | <?php
namespace Database\Factories;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;
class PodcastFactory extends Factory
{
/** @inheritdoc */
public function definition(): array
{
return [
'title' => $this->faker->sentence,
'description' => $this->faker->paragraph,
'image' => $this->faker->imageUrl(),
'link' => $this->faker->url,
'url' => $this->faker->url,
'author' => $this->faker->name,
'categories' => [
['text' => 'Technology', 'sub_category' => null],
],
'explicit' => $this->faker->boolean,
'language' => $this->faker->languageCode,
'metadata' => [
'locked' => $this->faker->boolean,
'guid' => Str::uuid()->toString(),
'owner' => $this->faker->name,
'copyright' => $this->faker->sentence,
'txts' => [],
'fundings' => [],
'type' => 'episodic',
'complete' => $this->faker->boolean,
],
'added_by' => User::factory(),
'last_synced_at' => now(),
];
}
}
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/database/factories/LicenseFactory.php | database/factories/LicenseFactory.php | <?php
namespace Database\Factories;
use App\Values\License\LicenseInstance;
use App\Values\License\LicenseMeta;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;
class LicenseFactory extends Factory
{
/** @inheritdoc */
public function definition(): array
{
return [
'key' => Str::uuid()->toString(),
'hash' => Str::random(32),
'instance' => LicenseInstance::make(
id: Str::uuid()->toString(),
name: 'Koel Plus',
createdAt: now(),
),
'meta' => LicenseMeta::make(
customerId: $this->faker->numberBetween(1, 1000),
customerName: $this->faker->name(),
customerEmail: $this->faker->email()
),
'expires_at' => null,
];
}
}
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/database/factories/AlbumFactory.php | database/factories/AlbumFactory.php | <?php
namespace Database\Factories;
use App\Helpers\Ulid;
use App\Models\Artist;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
class AlbumFactory extends Factory
{
/** @inheritdoc */
public function definition(): array
{
return [
'user_id' => User::factory(),
'artist_id' => Artist::factory(),
'artist_name' => static fn (array $attributes) => Artist::query()->find($attributes['artist_id'])->name, // @phpstan-ignore-line
'name' => $this->faker->colorName,
'cover' => Ulid::generate() . '.jpg',
'year' => $this->faker->year,
];
}
}
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/database/factories/PlaylistFactory.php | database/factories/PlaylistFactory.php | <?php
namespace Database\Factories;
use App\Helpers\Ulid;
use App\Models\Playlist;
use App\Models\User;
use App\Values\SmartPlaylist\SmartPlaylistRule;
use App\Values\SmartPlaylist\SmartPlaylistRuleGroup;
use App\Values\SmartPlaylist\SmartPlaylistRuleGroupCollection;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;
class PlaylistFactory extends Factory
{
/** @inheritdoc */
public function definition(): array
{
return [
'name' => $this->faker->name,
'rules' => null,
'description' => $this->faker->realText(),
'cover' => Ulid::generate() . '.webp',
];
}
public function smart(): static
{
return $this->state(fn () => [ // @phpcs:ignore
'rules' => SmartPlaylistRuleGroupCollection::create([
SmartPlaylistRuleGroup::make([
'id' => Str::uuid()->toString(),
'rules' => [
SmartPlaylistRule::make([
'id' => Str::uuid()->toString(),
'model' => 'artist.name',
'operator' => 'is',
'value' => ['foo'],
]),
],
]),
]),
]);
}
public function configure(): static
{
// @phpstan-ignore-next-line
return $this->afterCreating(static function (Playlist $playlist): void {
$playlist->users()->attach(User::factory()->create(), ['role' => 'owner']);
});
}
}
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/database/factories/FavoriteFactory.php | database/factories/FavoriteFactory.php | <?php
namespace Database\Factories;
use App\Enums\FavoriteableType;
use App\Models\Song;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
class FavoriteFactory extends Factory
{
/** @inheritdoc */
public function definition(): array
{
return [
'user_id' => User::factory(),
'favoriteable_type' => FavoriteableType::PLAYABLE->value,
'favoriteable_id' => Song::factory(),
];
}
}
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/database/factories/EmbedFactory.php | database/factories/EmbedFactory.php | <?php
namespace Database\Factories;
use App\Enums\EmbeddableType;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
class EmbedFactory extends Factory
{
/** @inheritdoc */
public function definition(): array
{
/** @var EmbeddableType $type */
$type = $this->faker->randomElement(EmbeddableType::cases());
return [
'user_id' => User::factory(),
'embeddable_type' => $type->value,
'embeddable_id' => $type->modelClass()::factory(),
];
}
}
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/database/factories/SettingFactory.php | database/factories/SettingFactory.php | <?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
class SettingFactory extends Factory
{
/** @inheritdoc */
public function definition(): array
{
return [
'key' => $this->faker->slug,
'value' => $this->faker->name,
];
}
}
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/database/factories/QueueStateFactory.php | database/factories/QueueStateFactory.php | <?php
namespace Database\Factories;
use App\Models\Song;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
class QueueStateFactory extends Factory
{
/** @inheritdoc */
public function definition(): array
{
return [
'user_id' => User::factory(),
'song_ids' => Song::factory()->count(3)->create()->modelKeys(),
'current_song_id' => null,
'playback_position' => 0,
];
}
}
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/database/factories/OrganizationFactory.php | database/factories/OrganizationFactory.php | <?php
namespace Database\Factories;
use App\Helpers\Ulid;
use App\Models\Organization;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends Factory<Organization>
*/
class OrganizationFactory extends Factory
{
/**
* @inheritdoc
*/
public function definition(): array
{
return [
'name' => $this->faker->company(),
'slug' => Ulid::generate(),
];
}
}
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/database/factories/ThemeFactory.php | database/factories/ThemeFactory.php | <?php
namespace Database\Factories;
use App\Models\User;
use App\Values\Theme\ThemeProperties;
use Illuminate\Database\Eloquent\Factories\Factory;
class ThemeFactory extends Factory
{
/** @inheritdoc */
public function definition(): array
{
return [
'name' => $this->faker->words(3, true),
'properties' => ThemeProperties::make(
fgColor: $this->faker->hexColor(),
bgColor: $this->faker->hexColor(),
bgImage: '',
highlightColor: $this->faker->hexColor(),
fontFamily: $this->faker->word(),
fontSize: $this->faker->numberBetween(13, 20),
),
'user_id' => User::factory(),
];
}
}
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/database/factories/TranscodeFactory.php | database/factories/TranscodeFactory.php | <?php
namespace Database\Factories;
use App\Models\Song;
use Illuminate\Database\Eloquent\Factories\Factory;
class TranscodeFactory extends Factory
{
/** @inheritdoc */
public function definition(): array
{
return [
'song_id' => Song::factory(),
'bit_rate' => $this->faker->randomElement([128, 192, 256, 320]),
'hash' => $this->faker->md5(),
'location' => $this->faker->filePath() . '.mp4',
];
}
}
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/database/factories/UserFactory.php | database/factories/UserFactory.php | <?php
namespace Database\Factories;
use App\Enums\Acl\Role;
use App\Models\Organization;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Str;
class UserFactory extends Factory
{
/** @inheritdoc */
public function definition(): array
{
return [
'name' => $this->faker->name,
'email' => $this->faker->email,
'password' => Hash::make('secret'),
'preferences' => [
'lastfm_session_key' => Str::random(),
],
'remember_token' => Str::random(10),
'organization_id' => Organization::default()->id,
];
}
public function admin(): self
{
return $this->afterCreating(static fn (User $user) => $user->syncRoles(Role::ADMIN)); // @phpstan-ignore-line
}
public function manager(): self
{
return $this->afterCreating(static fn (User $user) => $user->syncRoles(Role::MANAGER)); // @phpstan-ignore-line
}
public function prospect(): self
{
return $this->state(fn () => [ // @phpcs:ignore
'invitation_token' => Str::random(),
'invited_at' => now(),
'invited_by_id' => User::factory()->admin(),
]);
}
}
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/database/factories/InteractionFactory.php | database/factories/InteractionFactory.php | <?php
namespace Database\Factories;
use App\Models\Song;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
class InteractionFactory extends Factory
{
/** @inheritdoc */
public function definition(): array
{
return [
'song_id' => Song::factory(),
'user_id' => User::factory(),
'play_count' => $this->faker->randomNumber(),
'last_played_at' => now(),
];
}
}
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/database/factories/FolderFactory.php | database/factories/FolderFactory.php | <?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;
class FolderFactory extends Factory
{
private static function generateRandomPath(): string
{
return implode(
DIRECTORY_SEPARATOR,
[
bin2hex(random_bytes(5)),
Str::ulid(),
]
);
}
/** @inheritdoc */
public function definition(): array
{
return [
'path' => self::generateRandomPath(),
];
}
}
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/database/factories/GenreFactory.php | database/factories/GenreFactory.php | <?php
namespace Database\Factories;
use App\Models\Genre;
use Illuminate\Database\Eloquent\Factories\Factory;
class GenreFactory extends Factory
{
protected $model = Genre::class;
/** @inheritdoc */
public function definition(): array
{
return [
'name' => $this->faker->unique()->name(),
];
}
}
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/database/migrations/2022_07_05_085742_remove_default_album_covers.php | database/migrations/2022_07_05_085742_remove_default_album_covers.php | <?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;
return new class extends Migration
{
public function up(): void
{
DB::table('albums')->where('cover', 'unknown-album.png')->update(['cover' => '']);
}
};
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/database/migrations/2025_06_16_141017_create_organizations_table.php | database/migrations/2025_06_16_141017_create_organizations_table.php | <?php
use App\Models\Organization;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('organizations', static function (Blueprint $table): void {
$table->string('id', 26)->primary();
$table->string('name');
$table->string('slug')->unique();
$table->timestamps();
});
Schema::table('users', static function (Blueprint $table): void {
$table->string('organization_id', 26)->nullable()->after('id')->index();
});
DB::table('users')->update(['organization_id' => Organization::default()->id]);
Schema::table('users', static function (Blueprint $table): void {
$table->string('organization_id', 26)->nullable(false)->change();
$table->foreign('organization_id')
->references('id')
->on('organizations')
->cascadeOnDelete()
->cascadeOnUpdate();
});
}
};
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/database/migrations/2025_07_02_092423_create_failed_jobs_table.php | database/migrations/2025_07_02_092423_create_failed_jobs_table.php | <?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('failed_jobs', static function (Blueprint $table): void {
$table->id();
$table->string('uuid')->unique();
$table->text('connection');
$table->text('queue');
$table->longText('payload');
$table->longText('exception');
$table->timestamp('failed_at')->useCurrent();
});
}
};
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/database/migrations/2025_09_23_025435_migrate_admins.php | database/migrations/2025_09_23_025435_migrate_admins.php | <?php
use App\Enums\Acl\Role;
use App\Models\User;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
public function up(): void
{
// @phpstan-ignore-next-line
User::query()->where('is_admin', true)->each(static function (User $user): void {
$user->syncRoles(Role::ADMIN);
});
Schema::table('users', static function (Blueprint $table): void {
$table->dropColumn('is_admin');
});
}
};
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/database/migrations/2017_04_22_161504_drop_is_complication_from_albums.php | database/migrations/2017_04_22_161504_drop_is_complication_from_albums.php | <?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class DropIsComplicationFromAlbums extends Migration
{
public function up(): void
{
Schema::table('albums', static function (Blueprint $table): void {
$table->dropColumn('is_compilation');
});
}
public function down(): void
{
}
}
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/database/migrations/2022_08_04_092531_drop_contributing_artist_id.php | database/migrations/2022_08_04_092531_drop_contributing_artist_id.php | <?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
public function up(): void
{
Schema::table('songs', static function (Blueprint $table): void {
// This migration is actually to fix a mistake that the original one was deleted.
// Therefore, we just "try" it and ignore on error.
rescue_if(Schema::hasColumn('songs', 'contributing_artist_id'), static function () use ($table): void {
Schema::withoutForeignKeyConstraints(static function () use ($table): void {
$table->dropForeign(['contributing_artist_id']);
$table->dropColumn('contributing_artist_id');
});
});
});
}
};
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/database/migrations/2025_10_17_125814_add_themes_table.php | database/migrations/2025_10_17_125814_add_themes_table.php | <?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('themes', static function (Blueprint $table): void {
$table->string('id', 26)->primary();
$table->unsignedInteger('user_id')->index();
$table->string('name');
$table->string('thumbnail')->nullable();
$table->text('properties');
$table->timestamps();
$table->foreign('user_id')->on('users')->references('id')->cascadeOnDelete()->cascadeOnUpdate();
});
}
};
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/database/migrations/2024_01_16_223123_add_playlist_collaborations_table.php | database/migrations/2024_01_16_223123_add_playlist_collaborations_table.php | <?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('playlist_collaborators', static function (Blueprint $table): void {
$table->bigIncrements('id');
$table->unsignedInteger('user_id');
$table->string('playlist_id', 36);
$table->timestamps();
});
Schema::table('playlist_collaborators', static function (Blueprint $table): void {
$table->foreign('user_id')->references('id')->on('users')->cascadeOnDelete()->cascadeOnUpdate();
$table->foreign('playlist_id')->references('id')->on('playlists')->cascadeOnDelete()->cascadeOnUpdate();
});
}
};
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/database/migrations/2025_06_04_180008_add_public_id_column_into_users_table.php | database/migrations/2025_06_04_180008_add_public_id_column_into_users_table.php | <?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Str;
return new class extends Migration
{
public function up(): void
{
Schema::table('users', static function (Blueprint $table): void {
$table->string('public_id', 36)->unique()->nullable()->after('id');
});
DB::table('users')
->whereNull('public_id')
->orWhere('public_id', '')
->get()
->each(static function ($user): void {
DB::table('users')
->where('id', $user->id)
->update(['public_id' => Str::uuid()->toString()]);
});
}
};
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/database/migrations/2025_06_25_103531_add_genres_table.php | database/migrations/2025_06_25_103531_add_genres_table.php | <?php
use App\Helpers\Ulid;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
public function up(): void
{
Schema::create('genres', static function (Blueprint $table): void {
$table->id();
$table->string('public_id', 26)->unique();
$table->string('name');
});
Schema::create('genre_song', static function (Blueprint $table): void {
$table->id();
$table->string('song_id', 36)->index();
$table->unsignedBigInteger('genre_id')->index();
$table->foreign('song_id')->references('id')->on('songs')->cascadeOnDelete()->cascadeOnUpdate();
$table->foreign('genre_id')->references('id')->on('genres')->cascadeOnDelete()->cascadeOnUpdate();
});
self::migrateExistingData();
Schema::table('songs', static function (Blueprint $table): void {
$table->dropColumn('genre');
});
}
private static function migrateExistingData(): void
{
DB::table('songs')
->whereNotNull('genre')
->where('genre', '!=', '')
->get()
->each(static function ($song): void {
$genres = collect(explode(',', $song->genre))
->map(static fn ($genre) => trim($genre))
->filter() // remove empty strings
->unique();
if ($genres->isEmpty()) {
return;
}
$songGenres = [];
foreach ($genres as $name) {
$genreId = DB::table('genres')->where('name', $name)->first()?->id
?: DB::table('genres')->insertGetId([
'public_id' => Ulid::generate(),
'name' => $name,
]);
$songGenres[] = [
'song_id' => $song->id,
'genre_id' => $genreId,
];
}
DB::table('genre_song')->insert($songGenres);
});
}
};
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/database/migrations/2022_09_21_084050_more_tags.php | database/migrations/2022_09_21_084050_more_tags.php | <?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::table('songs', static function (Blueprint $table): void {
$table->year('year')->nullable();
$table->string('genre')->default('');
});
}
};
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/database/migrations/2016_03_20_134512_add_track_into_songs.php | database/migrations/2016_03_20_134512_add_track_into_songs.php | <?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddTrackIntoSongs extends Migration
{
public function up(): void
{
Schema::table('songs', static function (Blueprint $table): void {
$table->integer('track')->after('length')->nullable();
});
}
public function down(): void
{
Schema::table('songs', static function (Blueprint $table): void {
$table->dropColumn('track');
});
}
}
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/database/migrations/2025_09_21_062502_create_permission_tables.php | database/migrations/2025_09_21_062502_create_permission_tables.php | <?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
public function up(): void
{
$teams = config('permission.teams');
$tableNames = config('permission.table_names');
$columnNames = config('permission.column_names');
$pivotRole = $columnNames['role_pivot_key'] ?? 'role_id';
$pivotPermission = $columnNames['permission_pivot_key'] ?? 'permission_id';
Schema::create($tableNames['permissions'], static function (Blueprint $table): void {
$table->bigIncrements('id');
$table->string('name');
$table->string('guard_name');
$table->timestamps();
$table->unique(['name', 'guard_name']);
});
Schema::create($tableNames['roles'], static function (Blueprint $table) use ($teams, $columnNames): void {
$table->bigIncrements('id');
if ($teams || config('permission.testing')) { // permission.testing is a fix for sqlite testing
$table->unsignedBigInteger($columnNames['team_foreign_key'])->nullable();
$table->index($columnNames['team_foreign_key'], 'roles_team_foreign_key_index');
}
$table->string('name');
$table->string('guard_name');
$table->timestamps();
if ($teams || config('permission.testing')) {
$table->unique([$columnNames['team_foreign_key'], 'name', 'guard_name']);
} else {
$table->unique(['name', 'guard_name']);
}
});
Schema::create(
$tableNames['model_has_permissions'],
static function (Blueprint $table) use ($tableNames, $columnNames, $pivotPermission, $teams): void {
$table->unsignedBigInteger($pivotPermission);
$table->string('model_type');
$table->unsignedBigInteger($columnNames['model_morph_key']);
$table->index(
[$columnNames['model_morph_key'], 'model_type'],
'model_has_permissions_model_id_model_type_index',
);
$table->foreign($pivotPermission)
->references('id')
->on($tableNames['permissions'])
->onDelete('cascade');
if ($teams) {
$table->unsignedBigInteger($columnNames['team_foreign_key']);
$table->index($columnNames['team_foreign_key'], 'model_has_permissions_team_foreign_key_index');
$table->primary([
$columnNames['team_foreign_key'],
$pivotPermission,
$columnNames['model_morph_key'],
'model_type',
], 'model_has_permissions_permission_model_type_primary');
} else {
$table->primary([
$pivotPermission,
$columnNames['model_morph_key'],
'model_type',
], 'model_has_permissions_permission_model_type_primary');
}
},
);
Schema::create(
$tableNames['model_has_roles'],
static function (Blueprint $table) use ($tableNames, $columnNames, $pivotRole, $teams): void {
$table->unsignedBigInteger($pivotRole);
$table->string('model_type');
$table->unsignedInteger($columnNames['model_morph_key']);
$table->index(
[$columnNames['model_morph_key'], 'model_type'],
'model_has_roles_model_id_model_type_index',
);
$table->foreign($pivotRole)
->references('id') // role id
->on($tableNames['roles'])
->onDelete('cascade');
if ($teams) {
$table->unsignedBigInteger($columnNames['team_foreign_key']);
$table->index($columnNames['team_foreign_key'], 'model_has_roles_team_foreign_key_index');
$table->primary([
$columnNames['team_foreign_key'],
$pivotRole,
$columnNames['model_morph_key'],
'model_type',
], 'model_has_roles_role_model_type_primary');
} else {
$table->primary([
$pivotRole,
$columnNames['model_morph_key'],
'model_type',
], 'model_has_roles_role_model_type_primary');
}
}
);
Schema::create(
$tableNames['role_has_permissions'],
static function (Blueprint $table) use ($tableNames, $pivotRole, $pivotPermission): void {
$table->unsignedBigInteger($pivotPermission);
$table->unsignedBigInteger($pivotRole);
$table->foreign($pivotPermission)
->references('id') // permission id
->on($tableNames['permissions'])
->onDelete('cascade');
$table->foreign($pivotRole)
->references('id') // role id
->on($tableNames['roles'])
->onDelete('cascade');
$table->primary([$pivotPermission, $pivotRole], 'role_has_permissions_permission_id_role_id_primary');
},
);
app('cache')
->store(config('permission.cache.store') !== 'default' ? config('permission.cache.store') : null)
->forget(config('permission.cache.key'));
}
};
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/database/migrations/2025_06_03_121538_modify_playlist-user_relationship.php | database/migrations/2025_06_03_121538_modify_playlist-user_relationship.php | <?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
public function up(): void
{
// On GitHub Actions, MySQL sometimes falsely reports that the table does not exist (probably due to
// some race condition with the database connection).
if (!Schema::hasTable('playlist_collaborators')) {
return;
}
Schema::table('playlist_collaborators', static function (Blueprint $table): void {
$table->string('role')->default('collaborator');
$table->integer('position')->default(0);
});
DB::table('playlists')->get()->each(static function ($playlist): void {
DB::table('playlist_collaborators')->insert([
'user_id' => $playlist->user_id,
'playlist_id' => $playlist->id,
'role' => 'owner',
]);
});
Schema::table('playlist_collaborators', static function (Blueprint $table): void {
$table->rename('playlist_user');
});
Schema::table('playlists', static function (Blueprint $table): void {
Schema::withoutForeignKeyConstraints(static function () use ($table): void {
$table->dropForeign(['user_id']);
$table->dropColumn('user_id');
});
});
}
};
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/database/migrations/2016_07_09_054503_fix_artist_autoindex_value.php | database/migrations/2016_07_09_054503_fix_artist_autoindex_value.php | <?php
use Illuminate\Database\Migrations\Migration;
class FixArtistAutoindexValue extends Migration
{
public function up(): void
{
}
public function down(): void
{
}
}
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/database/migrations/2016_04_16_082627_create_various_artists.php | database/migrations/2016_04_16_082627_create_various_artists.php | <?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
class CreateVariousArtists extends Migration
{
/**
* Create the "Various Artists".
*
*/
public function up(): void
{
// Make sure modified artists cascade the album's artist_id field.
Schema::table('albums', static function (Blueprint $table): void {
if (DB::getDriverName() !== 'sqlite') { // @phpstan-ignore-line
$table->dropForeign('albums_artist_id_foreign');
}
$table->foreign('artist_id')->references('id')->on('artists')->onUpdate('cascade')->onDelete('cascade');
});
}
}
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/database/migrations/2023_04_17_114909_convert_playlist_rule_ids_to_uuid.php | database/migrations/2023_04_17_114909_convert_playlist_rule_ids_to_uuid.php | <?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Str;
return new class extends Migration {
public function up(): void
{
DB::table('playlists')
->whereNotNull('rules')
->where('rules', '<>', '')
->get()
->each(static function ($playlist): void {
$groups = array_map(static function ($rule): array {
return [
'id' => Str::uuid()->toString(),
'rules' => array_map(static function ($rule): array {
return [
'id' => Str::uuid()->toString(),
'model' => $rule->model,
'operator' => $rule->operator,
'value' => $rule->value,
];
}, $rule->rules),
];
}, json_decode($playlist->rules, false));
DB::table('playlists')
->where('id', $playlist->id)
->update(['rules' => json_encode($groups)]);
});
}
};
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/database/migrations/2017_04_29_025836_rename_contributing_artist_id.php | database/migrations/2017_04_29_025836_rename_contributing_artist_id.php | <?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class RenameContributingArtistId extends Migration
{
public function up(): void
{
Schema::table('songs', static function (Blueprint $table): void {
$table->integer('artist_id')->unsigned()->nullable();
$table->foreign('artist_id')->references('id')->on('artists')->onDelete('cascade');
});
}
}
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/database/migrations/2025_06_17_125054_add_mime_type_to_songs_table.php | database/migrations/2025_06_17_125054_add_mime_type_to_songs_table.php | <?php
use App\Models\Song;
use FileEye\MimeMap\Extension;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Str;
return new class extends Migration {
private const DEFAULT_MIME_TYPE = 'audio/mpeg'; // Default to mp3
public function up(): void
{
Schema::table('songs', static function (Blueprint $table): void {
$table->string('mime_type')->nullable();
});
DB::table('songs')
->whereNull('podcast_id')
->chunkById(100, static function ($songs): void {
$cases = '';
$ids = [];
/** @var Song $song */
foreach ($songs as $song) {
$ids[] = $song->id;
$mimeType = self::guessMimeType($song);
$cases .= "WHEN '$song->id' THEN '$mimeType' ";
}
DB::table('songs')
->whereIn('id', $ids)
->update(['mime_type' => DB::raw("CASE id $cases END")]);
});
}
public static function guessMimeType(object $song): string
{
static $extToMimeMap = [];
$extension = Str::afterLast($song->path, '.');
if (!$extension) {
return self::DEFAULT_MIME_TYPE;
}
if (!isset($extToMimeMap[$extension])) {
try {
$mimeType = strtolower((new Extension($extension))->getDefaultType());
} catch (Throwable) {
$mimeType = self::DEFAULT_MIME_TYPE;
}
$extToMimeMap[$extension] = $mimeType;
}
return $extToMimeMap[$extension];
}
};
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/database/migrations/2022_06_11_091750_add_indexes.php | database/migrations/2022_06_11_091750_add_indexes.php | <?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::table('songs', static function (Blueprint $table): void {
if (DB::getDriverName() === 'sqlite') {
$table->index('title');
} else {
$table->fullText('title');
}
$table->index(['track', 'disc']);
});
Schema::table('albums', static function (Blueprint $table): void {
if (DB::getDriverName() === 'sqlite') {
$table->index('name');
} else {
$table->fullText('name');
}
});
}
};
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/database/migrations/2025_10_06_195925_add_file_size_to_songs_and_transcodes.php | database/migrations/2025_10_06_195925_add_file_size_to_songs_and_transcodes.php | <?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::table('songs', static function (Blueprint $table): void {
$table->unsignedBigInteger('file_size')->nullable();
});
Schema::table('transcodes', static function (Blueprint $table): void {
$table->unsignedBigInteger('file_size')->nullable();
});
}
};
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/database/migrations/2025_07_20_165324_backfill_ulid_foreign_keys.php | database/migrations/2025_07_20_165324_backfill_ulid_foreign_keys.php | <?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;
return new class extends Migration {
public function up(): void
{
// Update albums.artist_ulid from artists.public_id
DB::table('albums')->update([
'artist_ulid' => DB::raw('(SELECT public_id FROM artists WHERE artists.id = albums.artist_id)'),
]);
// Update songs.artist_ulid and songs.album_ulid
DB::table('songs')->update([
'artist_ulid' => DB::raw('(SELECT public_id FROM artists WHERE artists.id = songs.artist_id)'),
'album_ulid' => DB::raw('(SELECT public_id FROM albums WHERE albums.id = songs.album_id)'),
]);
}
};
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/database/migrations/2023_12_28_223335_create_queue_states_table.php | database/migrations/2023_12_28_223335_create_queue_states_table.php | <?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('queue_states', static function (Blueprint $table): void {
$table->increments('id');
$table->unsignedInteger('user_id');
$table->json('song_ids');
$table->string('current_song_id', 36)->nullable();
$table->unsignedInteger('playback_position')->default(0);
$table->timestamps();
});
Schema::table('queue_states', static function (Blueprint $table): void {
$table->foreign('user_id')->references('id')->on('users')->cascadeOnUpdate()->cascadeOnDelete();
$table->foreign('current_song_id')->references('id')->on('songs')->cascadeOnUpdate()->nullOnDelete();
});
}
};
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/database/migrations/2024_01_05_102651_add_license_support.php | database/migrations/2024_01_05_102651_add_license_support.php | <?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('licenses', static function (Blueprint $table): void {
$table->id();
$table->text('key');
$table->string('hash')->nullable()->unique();
$table->json('instance')->nullable();
$table->json('meta')->nullable();
$table->timestamp('expires_at')->nullable();
$table->timestamps();
});
}
};
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/database/migrations/2022_08_01_093952_use_uuids_for_song_ids.php | database/migrations/2022_08_01_093952_use_uuids_for_song_ids.php | <?php
use App\Helpers\Uuid;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::disableForeignKeyConstraints();
if (DB::getDriverName() !== 'sqlite') {
collect(['playlist_song', 'interactions'])->each(static function (string $table): void {
Schema::table($table, static function (Blueprint $table): void {
$table->dropForeign(['song_id']);
});
});
}
Schema::table('songs', static function (Blueprint $table): void {
$table->string('id', 36)->change();
});
Schema::table('playlist_song', static function (Blueprint $table): void {
$table->string('song_id', 36)->change();
$table->foreign('song_id')->references('id')->on('songs')->cascadeOnDelete()->cascadeOnUpdate();
});
Schema::table('interactions', static function (Blueprint $table): void {
$table->string('song_id', 36)->change();
$table->foreign('song_id')->references('id')->on('songs')->cascadeOnDelete()->cascadeOnUpdate();
});
DB::table('songs')->get()->each(static function ($song): void {
DB::table('songs')
->where('id', $song->id)
->update(['id' => Uuid::generate()]);
});
Schema::enableForeignKeyConstraints();
}
};
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/database/migrations/2014_10_12_000000_create_users_table.php | database/migrations/2014_10_12_000000_create_users_table.php | <?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateUsersTable extends Migration
{
public function up(): void
{
Schema::create('users', static function (Blueprint $table): void {
$table->increments('id');
$table->string('name');
$table->string('email')->unique();
$table->string('password', 60);
$table->boolean('is_admin')->default(false);
$table->rememberToken();
$table->timestamps();
});
}
public function down(): void
{
Schema::drop('users');
}
}
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/database/migrations/2024_03_31_094353_add_sso_id_into_users_table.php | database/migrations/2024_03_31_094353_add_sso_id_into_users_table.php | <?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::table('users', static function (Blueprint $table): void {
$table->string('sso_id')->nullable()->index();
$table->unique(['sso_provider', 'sso_id']);
});
}
};
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/database/migrations/2025_08_08_085019_support_radio_stations.php | database/migrations/2025_08_08_085019_support_radio_stations.php | <?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
public function up(): void
{
Schema::create('radio_stations', static function (Blueprint $table): void {
$table->string('id', 26)->primary();
$table->unsignedInteger('user_id');
$table->string('name');
$table->string('url');
$table->string('logo')->nullable();
$table->text('description')->nullable();
$table->boolean('is_public')->default(false);
$table->timestamps();
$table->foreign('user_id')->references('id')->on('users')->cascadeOnDelete()->cascadeOnUpdate();
});
}
};
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/database/migrations/2015_11_23_074600_create_artists_table.php | database/migrations/2015_11_23_074600_create_artists_table.php | <?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateArtistsTable extends Migration
{
public function up(): void
{
Schema::create('artists', static function (Blueprint $table): void {
$table->increments('id');
$table->string('name')->unique();
$table->timestamps();
});
}
public function down(): void
{
Schema::drop('artists');
}
}
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/database/migrations/2014_10_12_100000_create_password_resets_table.php | database/migrations/2014_10_12_100000_create_password_resets_table.php | <?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreatePasswordResetsTable extends Migration
{
public function up(): void
{
Schema::create('password_resets', static function (Blueprint $table): void {
$table->string('email')->index();
$table->string('token')->index();
$table->timestamp('created_at');
});
}
public function down(): void
{
Schema::drop('password_resets');
}
}
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/database/migrations/2024_07_14_180751_convert_json_columns_to_text.php | database/migrations/2024_07_14_180751_convert_json_columns_to_text.php | <?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('podcasts', static function (Blueprint $table): void {
$table->text('categories')->change();
$table->text('metadata')->change();
});
Schema::table('queue_states', static function (Blueprint $table): void {
$table->text('song_ids')->change();
});
Schema::table('licenses', static function (Blueprint $table): void {
$table->text('instance')->nullable()->change();
$table->text('meta')->nullable()->change();
});
Schema::table('songs', static function (Blueprint $table): void {
$table->text('episode_metadata')->nullable()->change();
});
Schema::table('podcast_user', static function (Blueprint $table): void {
$table->text('state')->nullable()->change();
});
}
};
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/database/migrations/2015_11_23_074733_create_interactions_table.php | database/migrations/2015_11_23_074733_create_interactions_table.php | <?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateInteractionsTable extends Migration
{
public function up(): void
{
Schema::create('interactions', static function (Blueprint $table): void {
$table->bigIncrements('id');
$table->integer('user_id')->unsigned();
$table->string('song_id', 32);
$table->boolean('liked')->default(false);
$table->integer('play_count')->default(0);
$table->timestamps();
});
Schema::table('interactions', static function (Blueprint $table): void {
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
$table->foreign('song_id')->references('id')->on('songs')->onDelete('cascade');
});
}
public function down(): void
{
Schema::drop('interactions');
}
}
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/database/migrations/2025_06_12_150202_user-scope_artists_and_albums.php | database/migrations/2025_06_12_150202_user-scope_artists_and_albums.php | <?php
use App\Facades\License;
use App\Helpers\Ulid;
use App\Models\Song;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
public function up(): void
{
Schema::table('artists', static function (Blueprint $table): void {
$table->string('public_id', 26)->unique()->nullable();
$table->unsignedInteger('user_id')->nullable()->index();
$table->foreign('user_id')->references('id')->on('users')->cascadeOnDelete()->cascadeOnUpdate();
});
Schema::table('albums', static function (Blueprint $table): void {
$table->string('public_id', 26)->unique()->nullable();
//Strictly saying we don't need user_id, but it's better for simplicity and performance.
$table->unsignedInteger('user_id')->nullable()->index();
$table->foreign('user_id')->references('id')->on('users')->cascadeOnDelete()->cascadeOnUpdate();
});
// set the default user_id for existing albums and artists to the first admin
$firstAdmin = DB::table('users')->where('is_admin', true)->oldest()->first();
if (!$firstAdmin) {
// No first admin exists, i.e., the database is empty (during the initial setup).
return;
}
DB::table('artists')
->chunkById(200, static function ($artists) use ($firstAdmin): void {
$cases = '';
$ids = [];
foreach ($artists as $artist) {
$ulid = Ulid::generate();
$cases .= "WHEN $artist->id THEN '$ulid' ";
$ids[] = $artist->id;
}
DB::table('artists')
->whereIn('id', $ids)
->update([
'user_id' => $firstAdmin->id,
'public_id' => DB::raw("CASE id $cases END"),
]);
});
DB::table('albums')
->chunkById(200, static function ($albums) use ($firstAdmin): void {
$cases = '';
$ids = [];
foreach ($albums as $album) {
$ulid = Ulid::generate();
$cases .= "WHEN $album->id THEN '$ulid' ";
$ids[] = $album->id;
}
DB::table('albums')
->whereIn('id', $ids)
->update([
'user_id' => $firstAdmin->id,
'public_id' => DB::raw("CASE id $cases END"),
]);
});
// For the CE, we stop here. All artists and albums are owned by the default user and shared across all users.
if (License::isCommunity()) {
return;
}
// For Koel Plus, we need to update songs that are not owned by the default user to
// have their corresponding artist and album owned by the same user.
DB::table('songs')
->join('albums', 'songs.album_id', '=', 'albums.id')
->join('artists', 'albums.artist_id', '=', 'artists.id')
->whereNull('songs.podcast_id')
->where('songs.owner_id', '!=', $firstAdmin->id)
->orderBy('songs.created_at')
->select(
'songs.*',
'artists.name as artist_name',
'artists.image as artist_image',
'albums.name as album_name',
'albums.cover as album_cover',
)
->chunk(100, static function ($songsChunk) use (&$artistCache, &$albumCache): void {
if (count($songsChunk) === 0) {
return;
}
$artistCases = [];
$albumCases = [];
$songIds = [];
/** @var Song $song */
foreach ($songsChunk as $song) {
$artistKey = "{$song->artist_name}|{$song->owner_id}";
$artistId = $artistCache[$artistKey]
?? tap(DB::table('artists')->insertGetId([
'name' => $song->artist_name,
'public_id' => Ulid::generate(),
'user_id' => $song->owner_id,
'image' => $song->artist_image ?? '',
]), static function ($id) use (&$artistCache, $artistKey): void {
$artistCache[$artistKey] = $id;
});
$albumKey = "{$song->album_name}|{$artistId}|{$song->owner_id}";
$albumId = $albumCache[$albumKey]
?? tap(DB::table('albums')->insertGetId([
'name' => $song->album_name,
'public_id' => Ulid::generate(),
'artist_id' => $artistId,
'user_id' => $song->owner_id,
'cover' => $song->album_cover ?? '',
]), static function ($id) use (&$albumCache, $albumKey): void {
$albumCache[$albumKey] = $id;
});
$songIds[] = $song->id;
$artistCases[$song->id] = $artistId;
$albumCases[$song->id] = $albumId;
}
// Build CASE statements for artist_id
$artistCaseSql = 'CASE id ';
foreach ($artistCases as $songId => $artistId) {
$artistCaseSql .= "WHEN '{$songId}' THEN {$artistId} ";
}
$artistCaseSql .= 'ELSE artist_id END';
// Build CASE statements for album_id
$albumCaseSql = 'CASE id ';
foreach ($albumCases as $songId => $albumId) {
$albumCaseSql .= "WHEN '{$songId}' THEN {$albumId} ";
}
$albumCaseSql .= 'ELSE album_id END';
// Run single batch update query
DB::table('songs')
->whereIn('id', $songIds)
->update([
'artist_id' => DB::raw($artistCaseSql),
'album_id' => DB::raw($albumCaseSql),
]);
});
}
};
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/database/migrations/2025_07_02_085134_create_jobs_table.php | database/migrations/2025_07_02_085134_create_jobs_table.php | <?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('jobs', static function (Blueprint $table): void {
$table->bigIncrements('id');
$table->string('queue')->index();
$table->longText('payload');
$table->unsignedTinyInteger('attempts');
$table->unsignedInteger('reserved_at')->nullable();
$table->unsignedInteger('available_at');
$table->unsignedInteger('created_at');
});
}
};
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/database/migrations/2025_05_17_131024_add_folders_table.php | database/migrations/2025_05_17_131024_add_folders_table.php | <?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
if (env('GITHUB_ACTIONS')) {
Schema::dropIfExists('folders'); // somehow MySQL yields an error but only on GitHub Actions
}
Schema::create('folders', static function (Blueprint $table): void {
$table->string('id', 36)->primary();
$table->string('parent_id', 36)->nullable()->index();
// no need to set a unique index here, as indexing text columns or using long varchar is unnecessarily
// complicated across different database systems
$table->text('path');
});
Schema::table('folders', static function (Blueprint $table): void {
$table->foreign('parent_id')->on('folders')->references('id')->cascadeOnDelete();
});
Schema::table('songs', static function (Blueprint $table): void {
$table->string('folder_id', 36)->nullable()->index();
$table->foreign('folder_id')->on('folders')->references('id')->nullOnDelete();
});
}
};
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/database/migrations/2016_04_15_125237_add_contributing_artist_id_into_songs.php | database/migrations/2016_04_15_125237_add_contributing_artist_id_into_songs.php | <?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddContributingArtistIdIntoSongs extends Migration
{
/**
* Run the migrations.
*
*/
public function up(): void
{
Schema::table('songs', static function (Blueprint $table): void {
$table->integer('contributing_artist_id')->unsigned()->nullable()->after('album_id');
$table->foreign('contributing_artist_id')->references('id')->on('artists')->onDelete('cascade');
});
}
/**
* Reverse the migrations.
*
*/
public function down(): void
{
Schema::table('songs', static function (Blueprint $table): void {
$table->dropColumn('contributing_artist_id');
});
}
}
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/database/migrations/2022_11_08_144634_add_last_played_at_into_interactions_table.php | database/migrations/2022_11_08_144634_add_last_played_at_into_interactions_table.php | <?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::table('interactions', static function (Blueprint $table): void {
$table->timestamp('last_played_at')->nullable();
});
DB::unprepared('UPDATE interactions SET last_played_at = updated_at');
DB::unprepared(
"UPDATE playlists SET rules = REPLACE(rules, 'interactions.updated_at', 'interactions.last_played_at')"
);
}
};
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/database/migrations/2025_07_04_090408_denormalize_artist_albums.php | database/migrations/2025_07_04_090408_denormalize_artist_albums.php | <?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::table('songs', static function (Blueprint $table): void {
$table->string('artist_name')->nullable()->index();
$table->string('album_name')->nullable()->index();
});
Schema::table('albums', static function (Blueprint $table): void {
$table->string('artist_name')->nullable()->index();
});
$pdo = DB::connection()->getPdo();
DB::table('songs')
->join('albums', 'songs.album_id', '=', 'albums.id')
->join('artists', 'albums.artist_id', '=', 'artists.id')
->whereNotNull('songs.artist_id')
->whereNotNull('songs.album_id')
->orderBy('songs.created_at')
->select('songs.id', 'artists.name as artist_name', 'albums.name as album_name')
->chunk(100, static function ($songs) use ($pdo): void {
$artistCases = [];
$albumCases = [];
$songIds = [];
foreach ($songs as $song) {
$songIds[] = $song->id;
$artistCases[$song->id] = $song->artist_name;
$albumCases[$song->id] = $song->album_name;
}
// Build CASE statements for artist_id
$artistCaseSql = 'CASE id ';
foreach ($artistCases as $songId => $artistName) {
$artistCaseSql .= sprintf("WHEN '{$songId}' THEN %s ", $pdo->quote($artistName));
}
$artistCaseSql .= 'ELSE artist_name END';
// Build CASE statements for album_id
$albumCaseSql = 'CASE id ';
foreach ($albumCases as $songId => $albumName) {
$albumCaseSql .= sprintf("WHEN '{$songId}' THEN %s ", $pdo->quote($albumName));
}
$albumCaseSql .= 'ELSE album_name END';
// Run single batch update query
DB::table('songs')
->whereIn('id', $songIds)
->update([
'artist_name' => DB::raw($artistCaseSql),
'album_name' => DB::raw($albumCaseSql),
]);
});
// Update albums with artist names
DB::table('albums')
->join('artists', 'albums.artist_id', '=', 'artists.id')
->whereNotNull('albums.artist_id')
->orderBy('albums.created_at')
->select('albums.id', 'artists.name as artist_name')
->chunk(100, static function ($albums) use ($pdo): void {
$albumCases = [];
$albumIds = [];
foreach ($albums as $album) {
$albumIds[] = $album->id;
$albumCases[$album->id] = $album->artist_name;
}
// Build CASE statements for artist_name
$albumCaseSql = 'CASE id ';
foreach ($albumCases as $albumId => $artistName) {
$albumCaseSql .= sprintf("WHEN '{$albumId}' THEN %s ", $pdo->quote($artistName));
}
$albumCaseSql .= 'ELSE artist_name END';
// Run single batch update query
DB::table('albums')
->whereIn('id', $albumIds)
->update([
'artist_name' => DB::raw($albumCaseSql),
]);
});
}
};
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/database/migrations/2025_05_18_181238_change_auditable_id_type.php | database/migrations/2025_05_18_181238_change_auditable_id_type.php | <?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
$connection = config('audit.drivers.database.connection', config('database.default'));
$table = config('audit.drivers.database.table', 'audits');
Schema::connection($connection)->table($table, static function (Blueprint $table): void {
$table->string('auditable_id')->change();
});
}
};
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/database/migrations/2015_11_23_082854_create_playlist_song_table.php | database/migrations/2015_11_23_082854_create_playlist_song_table.php | <?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreatePlaylistSongTable extends Migration
{
public function up(): void
{
Schema::create('playlist_song', static function (Blueprint $table): void {
$table->increments('id');
$table->integer('playlist_id')->unsigned();
$table->string('song_id', 32);
});
Schema::table('playlist_song', static function (Blueprint $table): void {
$table->foreign('playlist_id')->references('id')->on('playlists')->onDelete('cascade');
$table->foreign('song_id')->references('id')->on('songs')->onDelete('cascade');
});
}
public function down(): void
{
Schema::drop('playlist_song');
}
}
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/database/migrations/2024_04_18_093120_upgrade_sanctum_from2_to3.php | database/migrations/2024_04_18_093120_upgrade_sanctum_from2_to3.php | <?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::table('personal_access_tokens', static function (Blueprint $table): void {
$table->timestamp('expires_at')->nullable();
});
}
};
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/database/migrations/2025_05_13_114436_add_release_year_to_albums.php | database/migrations/2025_05_13_114436_add_release_year_to_albums.php | <?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::table('albums', static function (Blueprint $table): void {
$table->smallInteger('year')->nullable();
});
DB::table('albums')
->join('songs', 'albums.id', '=', 'songs.album_id')
->whereNull('albums.year')
->whereNotNull('songs.year')
->groupBy('albums.id', 'songs.id', 'songs.year')
->distinct('albums.id')
->get(['albums.id', 'songs.year'])
->each(static function ($album): void {
DB::table('albums')->where('id', $album->id)->update(['year' => $album->year]);
});
}
};
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
koel/koel | https://github.com/koel/koel/blob/add9401a4b9a904bb1b9f679bc674ad1570ff20e/database/migrations/2022_08_10_075423_support_playlist_folders.php | database/migrations/2022_08_10_075423_support_playlist_folders.php | <?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('playlist_folders', static function (Blueprint $table): void {
$table->string('id', 36)->primary();
$table->string('name');
$table->unsignedInteger('user_id');
$table->timestamps();
$table->foreign('user_id')->references('id')->on('users')->cascadeOnUpdate()->cascadeOnDelete();
});
Schema::table('playlists', static function (Blueprint $table): void {
$table->string('folder_id', 36)->nullable();
$table->foreign('folder_id')
->references('id')
->on('playlist_folders')
->cascadeOnUpdate()
->nullOnDelete();
});
}
};
| php | MIT | add9401a4b9a904bb1b9f679bc674ad1570ff20e | 2026-01-04T15:02:34.446708Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.