defaultStringLength(191); // Enable on delete cascade for sqlite connections if ($db->connection() instanceof SQLiteConnection) { $db->statement($db->raw('PRAGMA foreign_keys = ON')); } // Add some custom validation rules $validator->extend('path.valid', static fn ($attribute, $value): bool => is_dir($value) && is_readable($value)); // disable wrapping JSON resource in a `data` key JsonResource::withoutWrapping(); $this->app->bind(SpotifySession::class, static function () { return SpotifyService::enabled() ? new SpotifySession(config('koel.spotify.client_id'), config('koel.spotify.client_secret')) : null; }); $this->app->bind(MusicEncyclopedia::class, function () { return $this->app->get(LastfmService::enabled() ? LastfmService::class : NullMusicEncyclopedia::class); }); $this->app->when(LicenseService::class) ->needs(ApiClient::class) ->give(fn () => $this->app->get(LemonSqueezyApiClient::class)); $this->app->when(LicenseService::class) ->needs('$hashSalt') ->give(config('app.key')); } /** * Register any application services. */ public function register(): void { if ($this->app->environment() !== 'production' && class_exists('Laravel\Tinker\TinkerServiceProvider')) { $this->app->register('Laravel\Tinker\TinkerServiceProvider'); } } }