We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b959d91 commit 0dccaf9Copy full SHA for 0dccaf9
2 files changed
app/Livewire/Projects.php
@@ -54,8 +54,7 @@ private function projects(): LengthAwarePaginator
54
return Project::query()
55
->wherePublished()
56
->when($this->tag, fn ($query) => $query->withAnyTags($this->tag))
57
- ->orderByDesc('is_featured')
58
- ->latest()
+ ->defaultOrder()
59
->paginate(perPage: 12);
60
}
61
app/Models/Project.php
@@ -61,11 +61,12 @@ public function scopeDefaultOrder(Builder $query): Builder
->orderByDesc('published_at');
62
63
64
+ /**
65
+ * Scope a query to get only the published projects.
66
+ */
67
public function scopeWherePublished(Builder $query): void
68
{
- $query
- ->where('is_published', true)
- ->orderBy('id', 'desc');
69
+ $query->where('is_published', true);
70
71
72
/**
0 commit comments