#!/usr/bin/php make(Illuminate\Contracts\Http\Kernel::class); use App\Playlist; use App\Song; $playlist = Playlist::where('name',ltrim(getenv('PATH_INFO'),'/'))->first(); if($playlist){ $qs = getenv('QUERY_STRING'); if($qs){ $song = Song::find($qs); if(!$song){ printf("10 Enter a song id to add to this playlist \r\n"); return; } $playlist->songs()->toggle([$song->id]); printf("30 " . $playlist->name . "\r\n");return; } printf("20 text/gemini\r\n"); } else { printf("30 " . Playlist::inRandomOrder()->first()->name . "\r\n");return; } $songs = $playlist->songs()->pluck('title','songs.id'); ?> # name ?> => /playlist.gmi/name?>?q Add/remove from playlist. $title): ?> => /song.gmi.php/