Skip to content

Commit

Permalink
README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
alexvenga committed Dec 12, 2022
1 parent edc3cf7 commit 43733a3
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,34 +53,40 @@ function settings($key = null, $default = null)
```

or Blade directive @settings

```php
@settings('group.setting')
```

or as part of native Laravel config()

```php
@config('settings.group.setting')
```

For PHPStorm you can set this blade directive with [This instruction](https://www.jetbrains.com/help/phpstorm/blade-page.html)
For PHPStorm you can set this blade directive with [This instruction](https://www.jetbrains.com/help/phpstorm/blade-page.html)

## Update settings

You can use models VI\LaravelSiteSettings\Models\SettingGroup and VI\LaravelSiteSettings\Models\Setting

or set settings values with the settings() function:

```php
settings(['group.setting' => 'Value']);
settings(['setting' => 'Value']);
```

## Usage with MoonShine Laravel Admin

Please see [MoonShine](https://moonshine.cutcode.ru/)

You can publish two [MoonShine Resources](https://moonshine.cutcode.ru/resources-index) with command:

```bash
php artisan vendor:publish --provider="VI\LaravelSiteSettings\LaravelSiteSettingsProvider" --tag="moonshine"
```

and use them in your MoonShine admin panel, like this:

```php
Expand All @@ -91,11 +97,28 @@ MenuGroup::make('Settings', [
```

## Seeding settings

I recommend saving the settings in the seeders using the [orangehill/iseed](https://github.com/orangehill/iseed) package:

```bash
php artisan iseed setting_groups,settings
```

But you can use seeder or migration to set your settings

```php
settings([
['group.setting1' => 'Value1'],
['group.setting2' => 'Value2'],
['group.setting3' => 'Value3'],
['setting1' => 'Value4'],
['setting2' => 'Value5'],
['setting3' => 'Value6'],
['setting4' => 'Value7'],
['setting5' => 'Value8']
]);
```

## Credits

- [Alex](https://github.com/alexvenga)
Expand Down

0 comments on commit 43733a3

Please sign in to comment.