A Package to generate Dynamic Settings with a Simple Form Builder.
You can install the package via composer:
composer require vidwan/settings
File: Vidwan\Settings\Settings
use Vidwan\Settings\Settings;
...
Settings::form(Setting::all())
->labelAttributes(['class' => 'form-label'])
->inputAttributesFor('text', [
'class' => 'form-control',
])
->inputAttributesFor('innerBlock', [
'checkbox' => [
'class' => 'form-control',
],
])
->inputAttributesFor('checkbox', function ($settings) {
return [
'class' => 'form-check',
];
})
->formAttributes(['id' => 'settings-form'])
->blockAttributes(['class' => 'mb-1'])
->uploadable()
->render();
use Vidwan\Settings\Models\Setting;
$settings = Setting::all();
foreach ($settings as $setting)
{
$setting->formLabel(attributes: ['class' => 'something']); // <label></label>
$setting->formInput(attributes: ['class' => 'form-control']); // <input />
}
settings('theme');
Ignoring auto-migrations (without publishing) and specifying the path to publish migrations.
use Vidwan\Settings\Settings;
...
class AppServiceProvider extends ServiceProvider
{
...
/**
* Register any application services.
*
* @return void
*/
public function register()
{
// Disable auto-migration
Settings::$runsMigrations = false;
// Sets Migration Path
Settings::$migrationPath = database_path('migrations/tenant');
}
...
}
composer test
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
Please review our security policy on how to report security vulnerabilities.
You can support us by contributing to our open source projects or Sponsoring the projects you use.
The MIT License (MIT). Please see License File for more information.