Download the PHP package agroezinger/filament-app-settings without Composer
On this page you can find all versions of the php package agroezinger/filament-app-settings. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download agroezinger/filament-app-settings
More information about agroezinger/filament-app-settings
Files in agroezinger/filament-app-settings
Package filament-app-settings
Short Description Flexible polymorphic settings for Laravel with Multi-Tenancy and fallback support.
License MIT
Homepage https://github.com/agroezinger/filament-app-settings
Informations about the package filament-app-settings
agroezinger/filament-app-settings
Flexible, polymorphic key-value settings for Laravel with multi-tenancy and cascading fallback support.
Features
- Polymorphic scope — attach settings to any Eloquent model (department, user, …) or store them tenant- or system-wide
- Three-level fallback — model-specific → tenant-wide → system-wide
- Filament multi-tenancy — tenant ID is resolved automatically via
filament()->getTenant() - Cache — all reads are cached forever; writes flush the relevant cache key
app_setting()helper — ergonomic global shortcut
Requirements
- PHP 8.4+
- Laravel 11 or 12
- Optional: Filament v3+ (for automatic tenant resolution)
Installation
1. Require the package
2. Publish and run the migration
This creates the app_settings table. The package registers itself automatically via Laravel's package auto-discovery — no manual provider registration needed.
3. Done
Database schema
Basic usage
Global helper
Model-scoped settings
Bulk write
Explicit tenant ID
Useful in seeders or console commands where no Filament tenant is active:
Model-scoped bulk read
Retrieve all settings for a given key across every model of a type:
Fallback chain
get() resolves settings in this order, returning the first non-null match:
- Model-specific in current tenant (if
$modelis provided) - Tenant-wide (
model_id = 0,model_type = 'system', current tenant) - System-wide (
tenant_id = 0) — only checked when inside a tenant context
This lets you define global defaults at system level and override them per tenant or per model.
Multi-tenancy
The tenant ID is resolved automatically:
- Inside a Filament panel — uses
filament()->getTenant()->getKey() - Anywhere else — falls back to
0(system / single-tenant)
No configuration required if you use Filament. For custom tenant resolution, extend AppSettings and override getTenantId().
Extending
Stored value types
value is a native JSON column. Eloquent's json cast handles encoding and decoding automatically:
| PHP value stored | MySQL JSON | PHP value retrieved |
|---|---|---|
'true' (string) |
"true" |
'true' (string) |
true (bool) |
true |
true (bool) |
42 (int) |
42 |
42 (int) |
['a', 'b'] (array) |
["a","b"] |
['a', 'b'] (array) |
null |
null |
null |
Note: Avoid querying the
app_settingstable with rawDB::table()and->where('value', 'some-string')— MySQL's JSON column comparison does not match SQL strings against JSON-encoded strings directly. Use theAppSettingsservice instead, or applyJSON_UNQUOTE(value) = ?in raw queries.
Changelog
See CHANGELOG.md.
License
MIT — see LICENSE.md.
All versions of filament-app-settings with dependencies
illuminate/database Version ^11.0|^12.0
illuminate/support Version ^11.0|^12.0
spatie/laravel-package-tools Version ^1.16