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
i want define a filter for my eloquent scope
for example :
<?php
namespace App\Models;
use Abbasudo\Purity\Traits\Filterable;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
class User extends Model
{
use Filterable;
public function scopeWithSubscription(Builder $query, bool $value): void
{
if ($value) {
$query->where('expired_at', '>=', now());
} else {
$query->where('expired_at', '<', now())->orWhereNull('expired_at');
}
}
}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
i want define a filter for my eloquent scope
for example :
Beta Was this translation helpful? Give feedback.
All reactions