[ad_1]
i want to test my scope in my Statistic Model —>
class Statistic extends Model
{
use HasTranslations;
use HasFactory;
public $translatable = ['country'];
protected $guarded = ['id'];
public function scopeFilter($query, array $filters): Builder
{
return $query->when($filters['search'] ?? false, fn ($query, $search) => $query-
>where(DB::raw('lower(country)'), 'like', '%' . strtolower($search) . '%'));
}
}
how can i organize this?
How to correctly write Feature test for this?
[ad_2]