cwsps154 / laravel-settings
Package that help for creating settings in your Laravel project
Installs: 18
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Language:Blade
Requires
- php: ^7.4|^8.0|^8.1|^8.2
- cwsps154/bootstrap-ui-components: ^2.0
- laravel/framework: ^8.0|^9.0|^10.0
README
Help to build ui elements with bootstrap using laravel components
Installation
Using Composer
composer require cwsps154/laravel-settings
To publishing the package files
php artisan vendor:publish
You can use tag also
php artisan vendor:publish --tag=config --tag=components --tag=views --tag=migrations
Usage
Use this model CWSPS154\Settings\Models\Setting
in the AppServiceProvider
class and add below code in the boot method on you project.
public function boot() { if (!app()->runningInConsole()) { $settings = cache()->remember( 'settings', 3600, fn() => Setting::all()->keyBy('key') ); View::share('settings', $settings); } }
Then you can use the settings with this code in anywhere in the blade pages
$settings['your-key-name']->value ?? $settings['your-key-name']->default