public static function enqueue($details = []) { if (!empty($details)) { MusicHistory::create(['url' => $details['url'], 'time_out' => Carbon::now(), 'user_out' => Session::getId()]); } return true; }
public static function markFlag($id) { // Create the flag FlagList::create(['url' => $id, 'time' => Carbon::now()]); // Remove from queue/history queue $items = MusicQueue::where('url', $id)->get(); // Shouldn't be in the queue more than once, but who knows foreach ($items as $item) { // Remove any copies of this video that might be in the queue $item->delete(); } // Get all items with the same url in music_history $items = MusicHistory::where('url', $id)->get(); // Remove all copies from music_history foreach ($items as $item) { $item->delete(); } }