How do you filter a custom/calculated field in Laravel Nova

Viewed 43

I have a text field that I need to be able to filter. This field is calculated and not directly on the model:

This returns true/false

Text::make('Post', function () {
     return $this->post->isActive();
}),

This is my filter. I want to be able to filter for true/falase

public function apply(Request $request, $query, $value)
{
     return $query->where('post', $value);
}
0 Answers
Related