{"id":20949870,"url":"https://github.com/visual-ideas/laravel-site-settings","last_synced_at":"2025-05-14T03:32:17.460Z","repository":{"id":64619950,"uuid":"576901999","full_name":"visual-ideas/laravel-site-settings","owner":"visual-ideas","description":"Easy laravel cached settings (stored in MYSQL) package with MoonShine/Filament Laravel Admin GUI","archived":false,"fork":false,"pushed_at":"2024-02-26T18:05:04.000Z","size":97,"stargazers_count":12,"open_issues_count":1,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-11-09T00:52:57.706Z","etag":null,"topics":["filament","filamentphp","laravel","laravel-admin","moonshine","mysql","php","settings"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/visual-ideas.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":"2022-12-11T11:12:32.000Z","updated_at":"2024-06-13T05:02:36.000Z","dependencies_parsed_at":"2023-01-31T05:16:20.649Z","dependency_job_id":null,"html_url":"https://github.com/visual-ideas/laravel-site-settings","commit_stats":null,"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/visual-ideas%2Flaravel-site-settings","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/visual-ideas%2Flaravel-site-settings/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/visual-ideas%2Flaravel-site-settings/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/visual-ideas%2Flaravel-site-settings/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/visual-ideas","download_url":"https://codeload.github.com/visual-ideas/laravel-site-settings/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225275153,"owners_count":17448383,"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":["filament","filamentphp","laravel","laravel-admin","moonshine","mysql","php","settings"],"created_at":"2024-11-19T00:44:19.832Z","updated_at":"2024-11-19T00:44:20.414Z","avatar_url":"https://github.com/visual-ideas.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Easy laravel cached settings\n\nEasy laravel cached settings (stored in MYSQL) package with MoonShine/Filament Laravel Admin GUI\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/visual-ideas/laravel-site-settings.svg?style=flat-square)](https://packagist.org/packages/visual-ideas/laravel-site-settings)\n[![Total Downloads](https://img.shields.io/packagist/dt/visual-ideas/laravel-site-settings.svg?style=flat-square)](https://packagist.org/packages/visual-ideas/laravel-site-settings)\n\n## Installation\n\nYou can install the package via composer:\n\n```bash\ncomposer require visual-ideas/laravel-site-settings\n```\n\nYou must run the migrations with:\n\n```bash\nphp artisan migrate\n```\n\nYou can publish the config file with:\n\n```bash\nphp artisan vendor:publish --provider=\"VI\\LaravelSiteSettings\\LaravelSiteSettingsProvider\" --tag=\"config\"\n```\n\nThis is the contents of the published config file:\n\n```php\nreturn [\n    'cache_key' =\u003e env('LSS_CACHE_KEY','laravel_site_settings_data'),\n   \n    // Set to true if you're using Filament (https://filamentphp.com/)\n    'filament' =\u003e false,\n];\n```\n\n## Usage\n\nYou can use this package as default laravel config() function!\n\n```php\nfunction settings($key = null, $default = null)\n{\n    if (is_null($key)) {\n        return app('Settings')-\u003eall();\n    }\n\n    if (is_array($key)) {\n        return app('Settings')-\u003eset($key);\n    }\n\n    return app('Settings')-\u003eget($key, $default);\n}\n```\n\nor Blade directive @settings\n\n```php\n@settings('group.setting')\n```\nFor PHPStorm you can set this blade directive with [This instruction](https://www.jetbrains.com/help/phpstorm/blade-page.html)\n\n\nor as part of native Laravel config()\n\n```php\n@config('settings.group.setting')\n```\n\n\u003cb\u003eNot working in console!\u003c/b\u003e\n\n## Update settings\n\nYou can use models VI\\LaravelSiteSettings\\Models\\SettingGroup and VI\\LaravelSiteSettings\\Models\\Setting\n\nor set settings values with the settings() function:\n\n```php\nsettings(['group.setting' =\u003e 'Value']);\nsettings(['setting' =\u003e 'Value']);\n```\n\n## Usage with MoonShine Laravel Admin panel\n\nPlease see [MoonShine](https://moonshine.cutcode.ru/)\n\nYou can use settings in your MoonShine admin panel, like this:\n\n```php\nMenuGroup::make('Settings', [\n    MenuItem::make(\n        'Setting groups',\n        new \\VI\\LaravelSiteSettings\\MoonShine\\Resources\\SettingGroupResource(),\n        'heroicons.outline.wrench-screwdriver'\n    ),\n    MenuItem::make(\n        'Settings',\n        new \\VI\\LaravelSiteSettings\\MoonShine\\Resources\\SettingResource(),\n        'heroicons.outline.wrench'\n    ),\n], 'heroicons.outline.cog-8-tooth'),\n```\n\n## Usage with Filament Laravel Admin panel\n\nPlease see [Filament](https://filamentphp.com)\n\nYou can use settings in your Filament admin panel!\n\nJust change config file:\n\n```php\n    //...   \n    // Set to true if you're using Filament (https://filamentphp.com/)\n    'filament' =\u003e true,\n    //...\n```\n\n## Seeding settings\n\nI recommend saving the settings in the seeders using the [orangehill/iseed](https://github.com/orangehill/iseed) package:\n\n```bash\nphp artisan iseed setting_groups,settings\n```\n\nBut you can use seeder or migration to set your settings\n\n```php\nsettings([\n    ['group.setting1' =\u003e 'Value1'],\n    ['group.setting2' =\u003e 'Value2'],\n    ['group.setting3' =\u003e 'Value3'],\n    ['setting1' =\u003e 'Value4'],\n    ['setting2' =\u003e 'Value5'],\n    ['setting3' =\u003e 'Value6'],\n    ['setting4' =\u003e 'Value7'],\n    ['setting5' =\u003e 'Value8']\n]);\n```\n\n## Credits\n\n- [Alex](https://github.com/alexvenga)\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE) for more information.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvisual-ideas%2Flaravel-site-settings","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvisual-ideas%2Flaravel-site-settings","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvisual-ideas%2Flaravel-site-settings/lists"}