vidwan / settings
Database Driven Dynamic Settings with Form Builder
Fund package maintenance!
secrethash
www.buymeacoffee.com/shashwatmishra
Requires
- php: ^8.0
- illuminate/auth: ^7.0|^8.0|^9.0
- illuminate/container: ^7.0|^8.0|^9.0
- illuminate/contracts: ^7.0|^8.0|^9.0
- illuminate/database: ^8.40.0|^9.0
- illuminate/support: ^7.0|^8.0|^9.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.0
- naoray/laravel-package-maker: ^4.0
- orchestra/testbench: ^6.0
- phpunit/phpunit: ^9.5
- vimeo/psalm: ^4.8
This package is auto-updated.
Last update: 2024-10-14 19:16:04 UTC
README
A Package to generate Dynamic Settings with a Simple Form Builder.
Installation
You can install the package via composer:
composer require vidwan/settings
Usage
Form Builder
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();
Single Label & Input Builder
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 /> }
Helper
settings('theme');
Ignoring Migration
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'); } ... }
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Support us
You can support us by contributing to our open source projects or Sponsoring the projects you use.
Credits
License
The MIT License (MIT). Please see License File for more information.