laravel / octane

Supercharge your Laravel application's performance.
https://laravel.com/docs/octane
MIT License
3.75k stars 291 forks source link

Flushing model global scopes #255

Closed DarkGhostHunter closed 3 years ago

DarkGhostHunter commented 3 years ago

More than a bug, is just a question. Does Laravel Octane flushes global scopes? I tried to find a call to Model::clearBootedModels() (which is done when the DatabaseServiceProvider registers) or a code for clearing the model scopes.

In case scopes are not cleared, this may break application that rely on dynamically scoping Models based on the request itself.

public function handle(Request $request, Closure $next)
{
    if ($user = $request->user()) {
        PrivatePhotos::addGlobalScope(new OwnedPrivatePhotos($user);
    }

    return $next($request);
}

Please close if I'm meando outside the tiesto.

nunomaduro commented 3 years ago

Laravel Octane does not flushes global scopes.