Skip to content

Commit

Permalink
Merge pull request #18 from RonasIT/dpankraov/order-by-related-fix
Browse files Browse the repository at this point in the history
Fixed bug with scopeOrderByRelated method in Laravel 8
  • Loading branch information
DenTray authored Mar 19, 2022
2 parents ecbfdc3 + 0144126 commit bef4c90
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Traits/ModelTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,12 @@ public function scopeAddFieldsToSelect($query, array $fields = [])
* @param $query
* @param $relations
* @param string $desc
* @param string $asField
* @param string|null $asField
* @param string $manyToManyStrategy
*
* @return QueryBuilder
* @return mixed $query
*/
public function scopeOrderByRelated(QueryBuilder $query, string $relations, string $desc = 'DESC', ?string $asField = null, string $manyToManyStrategy = 'max'): QueryBuilder
public function scopeOrderByRelated($query, $relations, string $desc = 'DESC', ?string $asField = null, string $manyToManyStrategy = 'max')
{
if (version_compare(app()::VERSION, '5.5') <= 0) {
return $query->legacyOrderByRelated($relations, $desc);
Expand Down

0 comments on commit bef4c90

Please sign in to comment.