Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Global Or Scope Laravel Package

lacodix/laravel-global-or-scope

Add multiple Eloquent global scopes that are grouped and applied with OR logic instead of the default AND. Use a simple trait to register OR-scopes and optionally disable some or all of them per query with withoutGlobalOrScopes().

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Leverage Laravel 12 compatibility: This package now supports Laravel 12, enabling PMs to adopt it for new projects or migrations to Laravel 12 without compatibility concerns. This aligns with roadmaps prioritizing modern PHP/Laravel stacks.
  • Simplify query logic: Global OR scopes (e.g., "always apply this filter") reduce boilerplate in Eloquent queries, improving developer velocity. Ideal for:
    • Admin panels with default filters (e.g., "show only active users").
    • Multi-tenant apps needing tenant-wide query constraints.
    • Analytics dashboards with pre-applied aggregations.
  • Build vs. Buy: Avoid reinventing scoped query logic; this package provides a lightweight, maintained solution for common use cases.
  • Tech debt reduction: Centralizes global query logic, making it easier to update filters across the codebase.

When to Consider This Package

  • Adopt if:
    • Your Laravel app (v8+) needs reusable, app-wide query constraints (e.g., soft deletes, tenant IDs, or role-based visibility).
    • You’re migrating to Laravel 12 and want to future-proof your query layer.
    • Your team spends time duplicating scope* methods across models.
  • Look elsewhere if:
    • You require complex, dynamic scopes (e.g., user-specific filters at runtime). This package focuses on global (static) scopes.
    • Your app uses non-Laravel PHP or frameworks outside the Laravel ecosystem.
    • You need real-time query modifications (e.g., WebSocket-driven updates). This is for persistent, app-wide logic.

How to Pitch It (Stakeholders)

For Executives: "This Laravel package lets us enforce consistent query rules (e.g., ‘always filter by tenant’) across our app with minimal code. It’s now compatible with Laravel 12, so we can use it for new projects or upgrades without risk. For example, if we’re building a multi-tenant SaaS, this handles tenant isolation automatically—saving dev time and reducing bugs. It’s a low-effort way to standardize how data is queried app-wide."

For Engineering: *"The laravel-global-or-scope package adds static, app-wide query scopes (e.g., GlobalScope for soft deletes or tenant IDs). Key updates:

  • Laravel 12 support: Safe to use in new projects or migrations.
  • Clean syntax: Replace repetitive scope* methods with declarative scopes (e.g., User::query()->get() now auto-applies your global rules).
  • Maintained: Actively updated (e.g., recent PSR-12 fixes). Use case: Add a TenantScope to all models in a multi-tenant app, or enforce ‘active only’ filters globally. Trade-off: Scopes are static—avoid for dynamic runtime filters."*
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui
babelqueue/php-sdk
facebook/capi-param-builder-php
babelqueue/symfony
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle