Skip to content

Commit d0db623

Browse files
authored
[Chore] Cache settings values (#1146)
1 parent e74a2d0 commit d0db623

File tree

1 file changed

+86
-0
lines changed

1 file changed

+86
-0
lines changed

config/settings.php

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
<?php
2+
3+
return [
4+
5+
/*
6+
* Each settings class used in your application must be registered, you can
7+
* put them (manually) here.
8+
*/
9+
'settings' => [
10+
11+
],
12+
13+
/*
14+
* The path where the settings classes will be created.
15+
*/
16+
'setting_class_path' => app_path('Settings'),
17+
18+
/*
19+
* In these directories settings migrations will be stored and ran when migrating. A settings
20+
* migration created via the make:settings-migration command will be stored in the first path or
21+
* a custom defined path when running the command.
22+
*/
23+
'migrations_paths' => [
24+
database_path('settings'),
25+
],
26+
27+
/*
28+
* When no repository was set for a settings class the following repository
29+
* will be used for loading and saving settings.
30+
*/
31+
'default_repository' => 'database',
32+
33+
/*
34+
* Settings will be stored and loaded from these repositories.
35+
*/
36+
'repositories' => [
37+
'database' => [
38+
'type' => Spatie\LaravelSettings\SettingsRepositories\DatabaseSettingsRepository::class,
39+
'model' => null,
40+
'table' => null,
41+
'connection' => null,
42+
],
43+
'redis' => [
44+
'type' => Spatie\LaravelSettings\SettingsRepositories\RedisSettingsRepository::class,
45+
'connection' => null,
46+
'prefix' => null,
47+
],
48+
],
49+
50+
/*
51+
* The contents of settings classes can be cached through your application,
52+
* settings will be stored within a provided Laravel store and can have an
53+
* additional prefix.
54+
*/
55+
'cache' => [
56+
'enabled' => env('SETTINGS_CACHE_ENABLED', true),
57+
'store' => env('CACHE_DRIVER', 'database'),
58+
'prefix' => null,
59+
'ttl' => null,
60+
],
61+
62+
/*
63+
* These global casts will be automatically used whenever a property within
64+
* your settings class isn't a default PHP type.
65+
*/
66+
'global_casts' => [
67+
DateTimeInterface::class => Spatie\LaravelSettings\SettingsCasts\DateTimeInterfaceCast::class,
68+
DateTimeZone::class => Spatie\LaravelSettings\SettingsCasts\DateTimeZoneCast::class,
69+
// Spatie\DataTransferObject\DataTransferObject::class => Spatie\LaravelSettings\SettingsCasts\DtoCast::class,
70+
// Spatie\LaravelData\Data::class => Spatie\LaravelSettings\SettingsCasts\DataCast::class,
71+
],
72+
73+
/*
74+
* The package will look for settings in these paths and automatically
75+
* register them.
76+
*/
77+
'auto_discover_settings' => [
78+
app_path('Settings'),
79+
],
80+
81+
/*
82+
* Automatically discovered settings classes can be cached, so they don't
83+
* need to be searched each time the application boots up.
84+
*/
85+
'discovered_settings_cache_path' => base_path('bootstrap/cache'),
86+
];

0 commit comments

Comments
 (0)