{"id":18933954,"url":"https://github.com/pxpm/backpack-crud-settings","last_synced_at":"2025-04-15T17:31:55.531Z","repository":{"id":54315449,"uuid":"233580638","full_name":"pxpm/backpack-crud-settings","owner":"pxpm","description":"Allow you to add settings to your backpack admin panel","archived":false,"fork":false,"pushed_at":"2021-02-24T16:20:06.000Z","size":47,"stargazers_count":8,"open_issues_count":1,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-11T23:16:41.691Z","etag":null,"topics":["backpack","laravel"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pxpm.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-01-13T11:31:26.000Z","updated_at":"2022-10-28T12:04:44.000Z","dependencies_parsed_at":"2022-08-13T11:50:28.452Z","dependency_job_id":null,"html_url":"https://github.com/pxpm/backpack-crud-settings","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pxpm%2Fbackpack-crud-settings","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pxpm%2Fbackpack-crud-settings/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pxpm%2Fbackpack-crud-settings/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pxpm%2Fbackpack-crud-settings/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pxpm","download_url":"https://codeload.github.com/pxpm/backpack-crud-settings/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249118709,"owners_count":21215608,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["backpack","laravel"],"created_at":"2024-11-08T11:56:55.663Z","updated_at":"2025-04-15T17:31:55.274Z","avatar_url":"https://github.com/pxpm.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Backpack Settings\n\n#### Create settings dashboards to your Backpack application.\n\n![bp_settings_main](https://user-images.githubusercontent.com/7188159/74541740-19563900-4f3a-11ea-8819-00f3687be636.PNG)\n\n### Instalation:\n\n`composer require pxpm/backpack-crud-settings`\n\n- Migrate the settings table:\n`php artisan db:migrate`\n\n Publish the config file\n `php artisan vendor:publish --provider=\"Pxpm\\BpSettings\\BpSettingsServiceProvider\" --tag=config`\n\nCreate a seeder that will seed your settings into database:\n\n`php artisan make:seeder SettingsSeeder`\n\n##### IMPORTANT NOTE\n\u003e This seeder will be the only source of truth for your settings. This is the way you can add/delete/update settings from database.\n\nThe above command will generate something like this in your `Database\\Seeds\\` folder by default in Laravel application.\n\n```php\n\u003c?php\n\nuse Illuminate\\Database\\Seeder;\n\nclass SettingsSeeder extends Seeder\n{\n    public function run()\n    {\n        //create your array of settings like defining Backpack fields.\n        $settings = [\n             [\n                'name' =\u003e 'company_name',\n                'type' =\u003e 'text',\n                'label' =\u003e 'Company Name',\n                'tab' =\u003e 'Main',\n                'wrapperAttributes' =\u003e ['class' =\u003e 'col-md-6 form-group']\n            ]\n        ];\n        \n        //call the setting manager to manage those settings. It will take care of create/update/delete settings.\n        app('settingsmanager')-\u003ecreate($settings);\n    }\n```\n\n##### NOTES: \n- After creating your seeder you should `composer dump-autoload` \n\n- Seed the settings with: `php artisan db:seed --class=SettingsSeeder`\n\n### Configuration\n\nIf you follow all the instalation steps you should now have an `bpsettings.php` file in your `config/` directory. The default config is ready to work out-of-box, but you are free to customize it the way you want.\n\n### Creating settings\n\n\u003e You can now access your settings panel in: `your_url.com/backpack_admin_prefix/bp-settings`\n\nTo add settings to your panels like described above you should create an array of `Backpack fields` and pass them to the `Settings Manager`. \nThere are some key points in setting definition that you can use to better organize your setting panels.\n\n##### namespace\nBy default the settings namespace is `null`, that means it's a general setting and will appear in the main settings panel. By defining settings namespaces you can create aditional setting panels. \n\nIf you setup some settings with `namespace =\u003e 'users'` those settings will be available separately in: `your_url.com/backpack_admin_prefix/bp-settings/users`\n\n##### group\nAllow you to group settings further inside the panel. You can use `tab` provided in Backpack with conjunction with group.\n\n##### validation\n\nYou can validate your settings inputs using regular laravel validation. \n\nDefine the key `validation =\u003e 'required|min:5'` and we will run your setting input against the laravel validator and return any errors found. \n\n\n### Using settings\n\n- All settings are pushed into config array on run-time. We use cache mechanism to make sure we don't query the database if there are no changes to settings and just grab the cached version.\n\nYou can get the values of `non namespaced` settings with: `config('bpsettings.setting_name)` or `app('settingsmanager)-\u003eget('setting_name')`\nTo get namespaced setting value you can do it with: `config('bpsettings.namespace.setting_name)` or `app('settingsmanager)-\u003eget('namespace.setting_name')`\n\n\n# IMPORTANT NOTE:\n\n\u003e This is still a work in progress, i cannot guarantee 100% flawless work.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpxpm%2Fbackpack-crud-settings","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpxpm%2Fbackpack-crud-settings","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpxpm%2Fbackpack-crud-settings/lists"}