Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Usage of queryCustomFilter #23

Open
deocampoej opened this issue Jan 22, 2025 · 0 comments
Open

Usage of queryCustomFilter #23

deocampoej opened this issue Jan 22, 2025 · 0 comments

Comments

@deocampoej
Copy link

Hi again, love your work, not really an issue but I was wondering how to use this custom query method in a Datatable class:

`protected function queryCustomFilter($query): void
{
$request = request();

    $request->validate([
        'f_date' => ['nullable', 'array', 'size:2'],
        'f_date.*' => ['date_format:d M Y'],
    ]);

    if($request->filled('f_date')){
        $query->whereBetween(Dtm::getMysqlQueryTzRawDB('`created_at`'), [
            Carbon::parse($request->f_date[0])->format("Y-m-d 00:00:00"), 
            Carbon::parse($request->f_date[1])->format("Y-m-d 23:59:59")
        ]);
    }
}`

is this meant to be used in the controller or just in the class itself?

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant