Fouladgar的简单使用Eloquent Builder class return 错误"it is not an interface"

Simple use of Fouladgar's Eloquent Builder class return error "it is not an interface"

我在创建使用 Eloquent 构建器 class 的简单过滤器时遇到问题。 Returns我的错误

App\EloquentFilters\Property\RoomsFilter cannot implement Fouladgar\EloquentBuilder\Support\Foundation\Contracts\Filter - it is not an interface

基本上是从如何开始复制粘贴的

<?php
namespace App\EloquentFilters\Property;
use Fouladgar\EloquentBuilder\Support\Foundation\Contracts\Filter;
use Illuminate\Database\Eloquent\Builder;
class RoomsFilter implements Filter
{
    public function apply(Builder $builder, $value): Builder
    {
        return $builder->where('rooms', $value);
    }
}

感谢大家的帮助

您需要扩展它,而不是像错误所说的那样实施它。

变化:

 class RoomsFilter implements Filter
{ }

class RoomsFilter extends Filter
{ }

来自gitHub repo

Writing a filter is simple. Define a class that extends the Fouladgar\EloquentBuilder\Support\Foundation\Contracts\Filter abstract class. This class requires you to implement one method: apply.