Skip to content

Flushing model global scopes #255

@DarkGhostHunter

Description

@DarkGhostHunter
  • Octane Version: 0.4
  • Laravel Version: 8.40.0
  • PHP Version: 8.0.3
  • Server: RoadRunner
  • Database Driver & Version: SQLite 3

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions