- Replace dated migrations with ordered 2026_04_07_* chain; fold users update into base migration - Update OrganisationScope, AppServiceProvider, seeders, api routes, and .env.example - Refresh Cursor rules, CLAUDE.md, Makefile, README, and docs (API, SCHEMA, SETUP) - Adjust admin/app/portal HTML, packages, api-client, events types, and theme config - Update docker-compose and VS Code settings; remove stray Office lock files from resources Made-with: Cursor
28 lines
854 B
PHP
28 lines
854 B
PHP
<?php
|
||
|
||
declare(strict_types=1);
|
||
|
||
namespace App\Models\Scopes;
|
||
|
||
use Illuminate\Database\Eloquent\Builder;
|
||
use Illuminate\Database\Eloquent\Model;
|
||
use Illuminate\Database\Eloquent\Scope;
|
||
|
||
/**
|
||
* Explicit organisation filter for queries ({@see Builder::withGlobalScope()}).
|
||
* Event data is currently scoped via the {@see Organisation} relationship and policies;
|
||
* when you add child models (persons, shifts, …), consider a global scope driven by
|
||
* the authenticated user’s active organisation (see `.cursor/rules/102_multi_tenancy.mdc`).
|
||
*/
|
||
final class OrganisationScope implements Scope
|
||
{
|
||
public function __construct(
|
||
private readonly string $organisationId,
|
||
) {}
|
||
|
||
public function apply(Builder $builder, Model $model): void
|
||
{
|
||
$builder->where($model->getTable() . '.organisation_id', $this->organisationId);
|
||
}
|
||
}
|