Flarum\Core\Post\RegisteredTypesScope::apply PHP Method

apply() public method

Apply the scope to a given Eloquent query builder.
public apply ( Builder $builder, Model $post ) : void
$builder Illuminate\Database\Eloquent\Builder
$post Illuminate\Database\Eloquent\Model
return void
    public function apply(Builder $builder, Model $post)
    {
        $query = $builder->getQuery();
        $this->whereIndex = count($query->wheres);
        $this->bindingIndex = count($query->getRawBindings()['where']);
        $types = array_keys($post::getModels());
        $this->bindingCount = count($types);
        $query->whereIn('type', $types);
    }
RegisteredTypesScope