Filter by a Non-Null Value in Laravel Nova

Posted 1 month ago by cameronscott137

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?

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.