Skip to content

Commit d8c339d

Browse files
committed
make publishing config optional
1 parent eff14f8 commit d8c339d

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

README.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ Via Composer
1616
``` bash
1717
$ composer require merodiro/settings
1818
```
19+
1920
publish config through
21+
Optional: only if you want to edit cache configurations
22+
2023
```bash
2124
$ php artisan vendor:publish --provider=Merodiro\Settings\SettingsServiceProvider
2225
```
@@ -56,10 +59,18 @@ Settings::flush();
5659

5760
### Get all settings
5861
Returns all settings stored in key => value array
62+
5963
```php
6064
$settings = Settings::all();
6165
```
6266

67+
### Get value from blade template
68+
69+
```php
70+
<h1>@settings('site-name')</h1>
71+
<h1>@settings('site-name', 'default name')</h1>
72+
```
73+
6374
### Cache all settings
6475
Caches all settings for the duration that has been set in settings.php config file
6576

@@ -73,14 +84,6 @@ php artisan settings:cache
7384
php artisan settings:clear
7485
```
7586

76-
### Get value from blade template
77-
78-
```php
79-
<h1>@settings('site-name')</h1>
80-
<h1>@settings('site-name', 'default name')</h1>
81-
```
82-
83-
8487
## Testing
8588

8689
``` bash

src/SettingsServiceProvider.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ public function boot()
1818
__DIR__.'/config/settings.php' => config_path('settings.php'),
1919
], 'config');
2020

21+
$this->mergeConfigFrom(
22+
__DIR__.'/config/settings.php',
23+
'settings'
24+
);
25+
2126
$this->loadMigrationsFrom(__DIR__ . '/migrations');
2227

2328
if ($this->app->runningInConsole()) {

0 commit comments

Comments
 (0)