feat(blog): blog yazilari tarihe gore sondan basa (DESC) siralandi

This commit is contained in:
Ümit Tunç
2026-09-01 14:58:42 +03:00
parent a2fe9e136b
commit b9a069b905
3 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -56,7 +56,7 @@ class BlogController extends Controller
}
$posts = $query
? $query->latest('published_at')->paginate(12)
? $query->orderByRaw('COALESCE(published_at, created_at) DESC')->paginate(12)
: collect();
// Blog sayfa ayarlarını bul (varsa)
+1 -1
View File
@@ -53,7 +53,7 @@ class CareerApplication extends Model
*/
public function blogs()
{
return $this->hasMany(Blog::class, 'career_application_id');
return $this->hasMany(Blog::class, 'career_application_id')->orderBy('created_at', 'desc');
}
protected static function booted()
@@ -3,7 +3,7 @@
$blogs = \App\Models\Blog::with(['category', 'author', 'careerApplication'])
->withCount('comments')
->published()
->latest('published_at')
->orderByRaw('COALESCE(published_at, created_at) DESC')
->limit(6)
->get();
@endphp