12-05-2026 Frontend dev
This commit is contained in:
parent
405df0a122
commit
5b8bdf4182
779 changed files with 480564 additions and 6241 deletions
36
app/Services/CurrentPortalContext.php
Normal file
36
app/Services/CurrentPortalContext.php
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use App\Enums\Portal;
|
||||
|
||||
/**
|
||||
* Hält den aktiven Portal-Kontext für den aktuellen Request.
|
||||
*
|
||||
* Wird vom SetCurrentPortal-Middleware gesetzt und von PortalScope gelesen.
|
||||
* In CLI-Befehlen und Queue-Jobs bleibt der Kontext null → kein Filter.
|
||||
*/
|
||||
class CurrentPortalContext
|
||||
{
|
||||
private static ?Portal $portal = null;
|
||||
|
||||
public static function set(?Portal $portal): void
|
||||
{
|
||||
static::$portal = $portal;
|
||||
}
|
||||
|
||||
public static function get(): ?Portal
|
||||
{
|
||||
return static::$portal;
|
||||
}
|
||||
|
||||
public static function isActive(): bool
|
||||
{
|
||||
return static::$portal !== null;
|
||||
}
|
||||
|
||||
public static function clear(): void
|
||||
{
|
||||
static::$portal = null;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue