Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

cameronscott137's avatar

Filter by a Non-Null Value in Laravel Nova

I'm trying to implement a basic filter using Laravel Nova. The filter looks at the field "onboarded_at," which is a datetime field. If the attribute has a timestamp, they're onboarded, and if not, they aren't.

Here's my filter:

public function apply(Request $request, $query, $value)
{
    return $query->where('onboarded_at', $value);
}

public function options(Request $request)
{
    return [
        'Onboarded' => !NULL, // How would I indicate a non-null value here?
        'Not Onboarded' => NULL,
    ];
}

How would I indicate a non-null value in the options function?

0 likes
2 replies
jlrdw's avatar

I think it's:

your_model::whereNotNull('Onboarded')

Please or to participate in this conversation.