algolia / scout-extended

Scout Extended: The Full Power of Algolia in Laravel
https://www.algolia.com/doc/framework-integration/laravel/getting-started/introduction-to-scout-extended/
MIT License
395 stars 85 forks source link

Builder withoutGlobalScopes is not a function #269

Open Sunhat opened 3 years ago

Sunhat commented 3 years ago

I'm using Laravel 5.7 with "algolia/scout-extended": "1.8",

In conjunction with Laravel Nova

e.g. in a Nova Resource:


    public static function scoutQuery(NovaRequest $request, $query)
    {
        $builder = parent::scoutQuery($request, $query);
        $builder->withoutGlobalScopes();
        return $builder;
    }

Prior to installing Algolia and making this model Searchable, this was working

$builder is \Algolia\ScoutExtended\Builder

Sunhat commented 3 years ago

To get around this issue, I've had to create a new Model


namespace App\Models\Algolia;

use App\Models\Yacht;
use Laravel\Scout\Searchable;

class Yacht extends ModelsYacht
{
    use Searchable;
}
DevinCodes commented 3 years ago

Hi @Sunhat , thank you for submitting this issue.

It seems like something might be wrong in the parent class of the resource, because AFAIK the scoutQuery method should return a \Laravel\Scout\Builder, and not a \Algolia\ScoutExtended\Builder. Could you show me the code in the parent's scoutQuery method so we can see if there's an issue in there?

Thank you in advance!