PHP code example of agroezinger / filament-app-settings
1. Go to this page and download the library: Download agroezinger/filament-app-settings library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
agroezinger / filament-app-settings example snippets
// Write a setting
app_setting()->set('site.name', 'My App');
// Read it back
$name = app_setting('site.name', 'Default');
use Agroezinger\FilamentAppSettings\AppSettings;
$settings = app(AppSettings::class);
// Write
$settings->set('invoice.footer', 'All prices e
// Delete by setting to null or ''
$settings->set('invoice.footer', null);
// Returns the value directly
$value = app_setting('invoice.footer', 'default');
// Returns the AppSettings instance when called without arguments
app_setting()->set('foo', 'bar');
app_setting()->setMany([...]);
class MyAppSettings extends \Agroezinger\FilamentAppSettings\AppSettings
{
protected function getTenantId(): int
{
return auth()->user()?->team_id ?? 0;
}
}
// Rebind in a ServiceProvider:
$this->app->singleton(\Agroezinger\FilamentAppSettings\AppSettings::class, fn() => new MyAppSettings());