Skip to content
Discussion options

You must be logged in to vote

Here is my answer. Thanks for user @siberfx who helped me with the idea.

CRUD::filter('top10')
            ->type('simple')
            ->whenActive(function() {
                $fourWeeksAgo = Carbon::now()->subWeeks(4);
                $now = Carbon::now()->endOfWeek();

                $limitValue = \App\Models\Child::withSum(['academicMarks as totalMarks' => function ($query) use ($fourWeeksAgo, $now) {
                    $query->whereBetween('date', [$fourWeeksAgo, $now]);
                }], 'mark')
                    ->having('totalMarks', '>=', 0)
                    ->orderBy('totalMarks', 'desc')
                    ->skip(9)
                    ->take(1)
                    -…

Replies: 3 comments 6 replies

Comment options

You must be logged in to vote
1 reply
@SyntaxConqueror
Comment options

Comment options

You must be logged in to vote
5 replies
@siberfx
Comment options

@SyntaxConqueror
Comment options

@pxpm
Comment options

pxpm Sep 24, 2024
Maintainer

@SyntaxConqueror
Comment options

@siberfx
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by SyntaxConqueror
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants