Skip to content

Commit 0dccaf9

Browse files
authored
wip
1 parent b959d91 commit 0dccaf9

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

app/Livewire/Projects.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@ private function projects(): LengthAwarePaginator
5454
return Project::query()
5555
->wherePublished()
5656
->when($this->tag, fn ($query) => $query->withAnyTags($this->tag))
57-
->orderByDesc('is_featured')
58-
->latest()
57+
->defaultOrder()
5958
->paginate(perPage: 12);
6059
}
6160
}

app/Models/Project.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,12 @@ public function scopeDefaultOrder(Builder $query): Builder
6161
->orderByDesc('published_at');
6262
}
6363

64+
/**
65+
* Scope a query to get only the published projects.
66+
*/
6467
public function scopeWherePublished(Builder $query): void
6568
{
66-
$query
67-
->where('is_published', true)
68-
->orderBy('id', 'desc');
69+
$query->where('is_published', true);
6970
}
7071

7172
/**

0 commit comments

Comments
 (0)