Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Builder withoutGlobalScopes is not a function #269

Open
Sunhat opened this issue Mar 10, 2021 · 2 comments
Open

Builder withoutGlobalScopes is not a function #269

Sunhat opened this issue Mar 10, 2021 · 2 comments

Comments

@Sunhat
Copy link

Sunhat commented Mar 10, 2021

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
Copy link
Author

Sunhat commented Mar 11, 2021

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
Copy link
Contributor

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants