src/Schema/Directives/SearchDirective.php
public function handleBuilder($builder, $value)
    {
        $within = $this->directiveArgValue('within');

        /** @var \Illuminate\Database\Eloquent\Model $modelClass */
        $modelClass = get_class(
            $builder->getModel()
        );

        /** @var \Laravel\Scout\Builder $builder */
        $builder = $modelClass::search($value);

        if ($within !== null) {
            $builder->within($within);
        }

        return $builder;
    }
public function handleBuilder($builder, $value)
    {
        $within = $this->directiveArgValue('within');

        /** @var \Illuminate\Database\Eloquent\Model $modelClass */
        $modelClass = get_class(
            $builder->getModel()
        );

        /** @var \Laravel\Scout\Builder $builder */
        $builder = $modelClass::search($value);

        if ($within !== null) {
            $builder->within($within);
        }

        return $builder;
    }
public function handleBuilder ( $ builder , $ value ) { $ within = $ this -> directiveArgValue ( 'within' ) ; /** @var \Illuminate\Database\Eloquent\Model $modelClass */ $ modelClass = get_class ( $ builder -> getModel ( ) ) ; /** @var \Laravel\Scout\Builder $builder */ $ builder = $ modelClass :: search ( $ value ) ; if ( $ within !== null ) { $ builder -> within ( $ within ) ; } return $ builder ; }
Apply a scout search to the builder.

@param  \Illuminate\Database\Query\Builder|\Illuminate\Database\Eloquent\Builder  $builder
@param  mixed  $value
@return \Laravel\Scout\Builder
Apply a scout search to the builder .