Is the second orderBy function only sort the records with the same value?
Have a look to the below query
UserProfile::whereDoesntHave('user.roles', function ($query) {
$query->where('pre_defined', true);
})->whereHas('user.roles')
->orderByDesc('total_score')
->orderBy('created_at', 'asc') // Sort by created_at ascending when total_score is 0
->pluck('user_id')->toArray();
Does the second OrderBy exclusively apply to instances where the total_score is 0, sorting them based on created_at, while the first OrderBy is solely responsible for sorting based on non-zero total_score values?
First it order by the author_name then it orders by the series, then part, and lastly published year.
That means that All the books of the author comes first, then the series of that authors book, all the books in one series, then it is order by the parts of each series, and lastly, if it doesn't belong to a series or has a part it is ordered by the year the book was published.