Skip to content

Commit 728d6c8

Browse files
committed
feat: add settings config
1 parent d5d6273 commit 728d6c8

3 files changed

Lines changed: 96 additions & 0 deletions

File tree

.env.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,5 @@ TYPESENSE_HOST=typesense
7676

7777
ECLIPSE_EMAIL_VERIFICATION=false
7878
PHPMYADMIN_URL="https://pma.eclipse-app.lndo.site/"
79+
80+
SETTINGS_CACHE_ENABLED=false

config/settings.php

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
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' => \Eclipse\Core\SettingsRepositories\SiteSettingsRepository::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 encoder and decoder will determine how settings are stored and
52+
* retrieved in the database. By default, `json_encode` and `json_decode`
53+
* are used.
54+
*/
55+
'encoder' => null,
56+
'decoder' => null,
57+
58+
/*
59+
* The contents of settings classes can be cached through your application,
60+
* settings will be stored within a provided Laravel store and can have an
61+
* additional prefix.
62+
*/
63+
'cache' => [
64+
'enabled' => env('SETTINGS_CACHE_ENABLED', false),
65+
'store' => null,
66+
'prefix' => null,
67+
'ttl' => null,
68+
],
69+
70+
/*
71+
* These global casts will be automatically used whenever a property within
72+
* your settings class isn't a default PHP type.
73+
*/
74+
'global_casts' => [
75+
DateTimeInterface::class => Spatie\LaravelSettings\SettingsCasts\DateTimeInterfaceCast::class,
76+
DateTimeZone::class => Spatie\LaravelSettings\SettingsCasts\DateTimeZoneCast::class,
77+
// Spatie\DataTransferObject\DataTransferObject::class => Spatie\LaravelSettings\SettingsCasts\DtoCast::class,
78+
Spatie\LaravelData\Data::class => Spatie\LaravelSettings\SettingsCasts\DataCast::class,
79+
],
80+
81+
/*
82+
* The package will look for settings in these paths and automatically
83+
* register them.
84+
*/
85+
'auto_discover_settings' => [
86+
app_path('Settings'),
87+
],
88+
89+
/*
90+
* Automatically discovered settings classes can be cached, so they don't
91+
* need to be searched each time the application boots up.
92+
*/
93+
'discovered_settings_cache_path' => base_path('bootstrap/cache'),
94+
];

database/settings/.gitkeep

Whitespace-only changes.

0 commit comments

Comments
 (0)