Dry7

@imposition try

$blogs = Blog::latest()
        ->filter(request()->only(['month', 'year']))
        ->get();
        if (isset($filters['month'])) {

            $query->whereMonth('created_at', Carbon::parse($filters['month'])->month);
        }
        
        if (isset($filters['year'])) {

            $query->whereYear('created_at', $filters['year']);
        }

Return to Thread...