playlists()->create([ 'name' => $name, 'rules' => $ruleGroups, ]); if (!$playlist->is_smart && $songs) { $playlist->songs()->sync($songs); } return $playlist; } }