Skip to content

Commit f44562d

Browse files
authored
Tidy up (#68)
* Remove timezone display * Update auth.php * Update auth.php * Update AppServiceProvider.php * Fix Ziggy error * Update database.php * Update filesystems.php * Update logging.php * Update mail.php * Update services.php * Update session.php
1 parent 73d7a36 commit f44562d

File tree

13 files changed

+117
-93
lines changed

13 files changed

+117
-93
lines changed

.env.example

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ APP_ENV=local
33
APP_KEY=base64:jpd/wy450S/8N0y6OfuRoZ8yS3AWEzrbkSgo08djF4w=
44
APP_DEBUG=true
55
APP_TIMEZONE=UTC
6-
APP_TIMEZONE_DISPLAY="Europe/London"
76
APP_URL=http://laravel-inertia-template.test
87

98
BCRYPT_ROUNDS=12

.env.testing

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ APP_ENV=testing
33
APP_KEY=base64:PGFsMHQa3kYad6OZbsaYzBnrdzxN3x+sfkkmqogVDuk=
44
APP_DEBUG=true
55
APP_TIMEZONE=UTC
6-
APP_TIMEZONE_DISPLAY="Europe/London"
76
APP_URL=http://laravel-inertia-template.test
87

98
BCRYPT_ROUNDS=4

app/Providers/AppServiceProvider.php

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace App\Providers;
44

55
use App\Models\User;
6-
use Carbon\Carbon;
76
use Illuminate\Http\Resources\Json\JsonResource;
87
use Illuminate\Support\ServiceProvider;
98
use Laravel\Pulse\Facades\Pulse;
@@ -15,14 +14,6 @@ public function boot(): void
1514
JsonResource::withoutWrapping();
1615

1716
// @codeCoverageIgnoreStart
18-
Carbon::macro('inAppTimezone', function () {
19-
return $this->tz(config('app.timezone_display'));
20-
});
21-
22-
Carbon::macro('inUserTimezone', function () {
23-
return $this->tz(auth()->user()?->timezone ?? config('app.timezone_display'));
24-
});
25-
2617
Pulse::users(function ($ids) {
2718
return User::findMany($ids)->map(fn ($user) => [
2819
'id' => $user->id,

config/app.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,6 @@
6767

6868
'timezone' => env('APP_TIMEZONE', 'UTC'),
6969

70-
'timezone_display' => env('APP_TIMEZONE_DISPLAY', 'UTC'),
71-
7270
/*
7371
|--------------------------------------------------------------------------
7472
| Application Locale Configuration

config/auth.php

Lines changed: 69 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,111 +1,108 @@
11
<?php
22

3+
use Illuminate\Support\Str;
4+
35
return [
46

57
/*
68
|--------------------------------------------------------------------------
7-
| Authentication Defaults
9+
| Default Cache Store
810
|--------------------------------------------------------------------------
911
|
10-
| This option controls the default authentication "guard" and password
11-
| reset options for your application. You may change these defaults
12-
| as required, but they're a perfect start for most applications.
12+
| This option controls the default cache store that will be used by the
13+
| framework. This connection is utilized if another isn't explicitly
14+
| specified when running a cache operation inside the application.
1315
|
1416
*/
1517

16-
'defaults' => [
17-
'guard' => env('AUTH_GUARD', 'web'),
18-
'passwords' => env('AUTH_PASSWORD_BROKER', 'users'),
19-
],
18+
'default' => env('CACHE_STORE', 'database'),
2019

2120
/*
2221
|--------------------------------------------------------------------------
23-
| Authentication Guards
22+
| Cache Stores
2423
|--------------------------------------------------------------------------
2524
|
26-
| Next, you may define every authentication guard for your application.
27-
| Of course, a great default configuration has been defined for you
28-
| here which uses session storage and the Eloquent user provider.
25+
| Here you may define all of the cache "stores" for your application as
26+
| well as their drivers. You may even define multiple stores for the
27+
| same cache driver to group types of items stored in your caches.
2928
|
30-
| All authentication drivers have a user provider. This defines how the
31-
| users are actually retrieved out of your database or other storage
32-
| mechanisms used by this application to persist your user's data.
33-
|
34-
| Supported: "session"
29+
| Supported drivers: "array", "database", "file", "memcached",
30+
| "redis", "dynamodb", "octane", "null"
3531
|
3632
*/
3733

38-
'guards' => [
39-
'web' => [
40-
'driver' => 'session',
41-
'provider' => 'users',
34+
'stores' => [
35+
36+
'array' => [
37+
'driver' => 'array',
38+
'serialize' => false,
4239
],
43-
],
4440

45-
/*
46-
|--------------------------------------------------------------------------
47-
| User Providers
48-
|--------------------------------------------------------------------------
49-
|
50-
| All authentication drivers have a user provider. This defines how the
51-
| users are actually retrieved out of your database or other storage
52-
| mechanisms used by this application to persist your user's data.
53-
|
54-
| If you have multiple user tables or models you may configure multiple
55-
| sources which represent each model / table. These sources may then
56-
| be assigned to any extra authentication guards you have defined.
57-
|
58-
| Supported: "database", "eloquent"
59-
|
60-
*/
41+
'database' => [
42+
'driver' => 'database',
43+
'connection' => env('DB_CACHE_CONNECTION'),
44+
'table' => env('DB_CACHE_TABLE', 'cache'),
45+
'lock_connection' => env('DB_CACHE_LOCK_CONNECTION'),
46+
'lock_table' => env('DB_CACHE_LOCK_TABLE'),
47+
],
6148

62-
'providers' => [
63-
'users' => [
64-
'driver' => 'eloquent',
65-
'model' => env('AUTH_MODEL', App\Models\User::class),
49+
'file' => [
50+
'driver' => 'file',
51+
'path' => storage_path('framework/cache/data'),
52+
'lock_path' => storage_path('framework/cache/data'),
6653
],
6754

68-
// 'users' => [
69-
// 'driver' => 'database',
70-
// 'table' => 'users',
71-
// ],
72-
],
55+
'memcached' => [
56+
'driver' => 'memcached',
57+
'persistent_id' => env('MEMCACHED_PERSISTENT_ID'),
58+
'sasl' => [
59+
env('MEMCACHED_USERNAME'),
60+
env('MEMCACHED_PASSWORD'),
61+
],
62+
'options' => [
63+
// Memcached::OPT_CONNECT_TIMEOUT => 2000,
64+
],
65+
'servers' => [
66+
[
67+
'host' => env('MEMCACHED_HOST', '127.0.0.1'),
68+
'port' => env('MEMCACHED_PORT', 11211),
69+
'weight' => 100,
70+
],
71+
],
72+
],
7373

74-
/*
75-
|--------------------------------------------------------------------------
76-
| Resetting Passwords
77-
|--------------------------------------------------------------------------
78-
|
79-
| You may specify multiple password reset configurations if you have more
80-
| than one user table or model in the application and you want to have
81-
| separate password reset settings based on the specific user types.
82-
|
83-
| The expire time is the number of minutes that each reset token will be
84-
| considered valid. This security feature keeps tokens short-lived so
85-
| they have less time to be guessed. You may change this as needed.
86-
|
87-
*/
74+
'redis' => [
75+
'driver' => 'redis',
76+
'connection' => env('REDIS_CACHE_CONNECTION', 'cache'),
77+
'lock_connection' => env('REDIS_CACHE_LOCK_CONNECTION', 'default'),
78+
],
8879

89-
'passwords' => [
90-
'users' => [
91-
'provider' => 'users',
92-
'table' => env('AUTH_PASSWORD_RESET_TOKEN_TABLE', 'password_reset_tokens'),
93-
'expire' => 60,
94-
'throttle' => 60,
80+
'dynamodb' => [
81+
'driver' => 'dynamodb',
82+
'key' => env('AWS_ACCESS_KEY_ID'),
83+
'secret' => env('AWS_SECRET_ACCESS_KEY'),
84+
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
85+
'table' => env('DYNAMODB_CACHE_TABLE', 'cache'),
86+
'endpoint' => env('DYNAMODB_ENDPOINT'),
9587
],
88+
89+
'octane' => [
90+
'driver' => 'octane',
91+
],
92+
9693
],
9794

9895
/*
9996
|--------------------------------------------------------------------------
100-
| Password Confirmation Timeout
97+
| Cache Key Prefix
10198
|--------------------------------------------------------------------------
10299
|
103-
| Here you may define the amount of seconds before a password confirmation
104-
| times out and the user is prompted to re-enter their password via the
105-
| confirmation screen. By default, the timeout lasts for three hours.
100+
| When utilizing the APC, database, memcached, Redis, and DynamoDB cache
101+
| stores, there might be other applications using the same cache. For
102+
| that reason, you may prefix every cache key to avoid collisions.
106103
|
107104
*/
108105

109-
'password_timeout' => env('AUTH_PASSWORD_TIMEOUT', 10800),
106+
'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache_'),
110107

111108
];

config/database.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@
3737
'database' => env('DB_DATABASE', database_path('database.sqlite')),
3838
'prefix' => '',
3939
'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
40+
'busy_timeout' => null,
41+
'journal_mode' => null,
42+
'synchronous' => null,
4043
],
4144

4245
'mysql' => [

config/filesystems.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
| may even configure multiple disks for the same driver. Examples for
2525
| most supported storage drivers are configured here for reference.
2626
|
27-
| Supported Drivers: "local", "ftp", "sftp", "s3"
27+
| Supported drivers: "local", "ftp", "sftp", "s3"
2828
|
2929
*/
3030

config/logging.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
| utilizes the Monolog PHP logging library, which includes a variety
4646
| of powerful log handlers and formatters that you're free to use.
4747
|
48-
| Available Drivers: "single", "daily", "slack", "syslog",
48+
| Available drivers: "single", "daily", "slack", "syslog",
4949
| "errorlog", "monolog", "custom", "stack"
5050
|
5151
*/

config/mail.php

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@
3030
| your mailers below. You may also add additional mailers if needed.
3131
|
3232
| Supported: "smtp", "sendmail", "mailgun", "ses", "ses-v2",
33-
| "postmark", "log", "array", "failover", "roundrobin"
33+
| "postmark", "resend", "log", "array",
34+
| "failover", "roundrobin"
3435
|
3536
*/
3637

@@ -45,7 +46,7 @@
4546
'username' => env('MAIL_USERNAME'),
4647
'password' => env('MAIL_PASSWORD'),
4748
'timeout' => null,
48-
'local_domain' => env('MAIL_EHLO_DOMAIN'),
49+
'local_domain' => env('MAIL_EHLO_DOMAIN', parse_url(env('APP_URL', 'http://localhost'), PHP_URL_HOST)),
4950
],
5051

5152
'ses' => [
@@ -60,6 +61,10 @@
6061
// ],
6162
],
6263

64+
'resend' => [
65+
'transport' => 'resend',
66+
],
67+
6368
'sendmail' => [
6469
'transport' => 'sendmail',
6570
'path' => env('MAIL_SENDMAIL_PATH', '/usr/sbin/sendmail -bs -i'),
@@ -82,6 +87,14 @@
8287
],
8388
],
8489

90+
'roundrobin' => [
91+
'transport' => 'roundrobin',
92+
'mailers' => [
93+
'ses',
94+
'postmark',
95+
],
96+
],
97+
8598
],
8699

87100
/*

config/services.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,25 @@
2121
'scheme' => 'https',
2222
],
2323

24+
'postmark' => [
25+
'token' => env('POSTMARK_TOKEN'),
26+
],
27+
28+
'ses' => [
29+
'key' => env('AWS_ACCESS_KEY_ID'),
30+
'secret' => env('AWS_SECRET_ACCESS_KEY'),
31+
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
32+
],
33+
34+
'resend' => [
35+
'key' => env('RESEND_KEY'),
36+
],
37+
38+
'slack' => [
39+
'notifications' => [
40+
'bot_user_oauth_token' => env('SLACK_BOT_USER_OAUTH_TOKEN'),
41+
'channel' => env('SLACK_BOT_USER_DEFAULT_CHANNEL'),
42+
],
43+
],
44+
2445
];

0 commit comments

Comments
 (0)