feat(blog): blog yazilari tarihe gore sondan basa (DESC) siralandi
This commit is contained in:
@@ -56,7 +56,7 @@ class BlogController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
$posts = $query
|
$posts = $query
|
||||||
? $query->latest('published_at')->paginate(12)
|
? $query->orderByRaw('COALESCE(published_at, created_at) DESC')->paginate(12)
|
||||||
: collect();
|
: collect();
|
||||||
|
|
||||||
// Blog sayfa ayarlarını bul (varsa)
|
// Blog sayfa ayarlarını bul (varsa)
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ class CareerApplication extends Model
|
|||||||
*/
|
*/
|
||||||
public function blogs()
|
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()
|
protected static function booted()
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
$blogs = \App\Models\Blog::with(['category', 'author', 'careerApplication'])
|
$blogs = \App\Models\Blog::with(['category', 'author', 'careerApplication'])
|
||||||
->withCount('comments')
|
->withCount('comments')
|
||||||
->published()
|
->published()
|
||||||
->latest('published_at')
|
->orderByRaw('COALESCE(published_at, created_at) DESC')
|
||||||
->limit(6)
|
->limit(6)
|
||||||
->get();
|
->get();
|
||||||
@endphp
|
@endphp
|
||||||
|
|||||||
Reference in New Issue
Block a user