You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello I am maintaining a project that uses this library for moderation, and on some of our content we like to filter by 'Approved', 'Pending' , 'Rejected', and 'Postponed'.
We have a custom Status Filter that extends Laravel\Nova\Filters\Filter. In this class, we define an apply method as such:
public function apply(Request $request, $query, $value)
{
switch($value) {
case $this->all:
default:
$query = $query->withAnyStatus();
break;
case ModerationStatus::PENDING:
$query = $query->pending();
break;
case ModerationStatus::APPROVED:
break;
case ModerationStatus::REJECTED:
$query = $query->rejected();
break;
case ModerationStatus::POSTPONED:
$query = $query->postponed();
break;
}
return $query;
}
Now I am sorry if this is the wrong place to be asking this, but as it pertains to Laravel and Nova, how can I add an approved() filter to the $query() that is being returned? I see this query is of type \Illuminate\Database\Eloquent\Builder and I kind of half expected to see this library extend that somewhere in the code. This however is not the case and digging through the API reference for \Illuminate\Database\Eloquent\Builder I don't see any reference to these methods being performed on the $query in the above function.
Could someone maybe point me in the right direction of where to look? Is hootlex not fully compatible with Laravel and Nova and therefore doesn't offer a way to filter by ModerationStatus::APPROVED ?
Any help would be greatly appreciated
The text was updated successfully, but these errors were encountered:
dev-ns8
changed the title
Building a Filter Query for ModerationStatus::Approved
Building a Filter Query for ModerationStatus::APPROVED
Jul 9, 2021
Hello I am maintaining a project that uses this library for moderation, and on some of our content we like to filter by 'Approved', 'Pending' , 'Rejected', and 'Postponed'.
We have a custom
Status
Filter that extendsLaravel\Nova\Filters\Filter
. In this class, we define an apply method as such:Now I am sorry if this is the wrong place to be asking this, but as it pertains to Laravel and Nova, how can I add an
approved()
filter to the$query()
that is being returned? I see this query is of type\Illuminate\Database\Eloquent\Builder
and I kind of half expected to see this library extend that somewhere in the code. This however is not the case and digging through the API reference for\Illuminate\Database\Eloquent\Builder
I don't see any reference to these methods being performed on the$query
in the above function.Could someone maybe point me in the right direction of where to look? Is hootlex not fully compatible with Laravel and Nova and therefore doesn't offer a way to filter by
ModerationStatus::APPROVED
?Any help would be greatly appreciated
The text was updated successfully, but these errors were encountered: