Skip to content

Commit 73218de

Browse files
authored
Assorted tweaks (#34)
* Install `predis/predis` * Set predis as default Redis client * Update composer.json * Update composer.json * Add shadows to design * Add rounded corners to design * Rename `$border-radiuses` Sass variable to `$radiuses` * Update app.js * Move colors to Sass variables * Fix extra gap in header on mobile * Add notice colors to Sass variable * Update NPM dependencies * Update Composer dependencies * Create organisation for user when registering * Assign user role when registering * Fix register test * Update phpunit.xml * Add more assertions to register test
1 parent c582e6f commit 73218de

File tree

23 files changed

+462
-304
lines changed

23 files changed

+462
-304
lines changed

.env.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ MEMCACHED_HOST=127.0.0.1
2929
REDIS_HOST=127.0.0.1
3030
REDIS_PASSWORD=null
3131
REDIS_PORT=6379
32+
REDIS_CLIENT=predis
3233

3334
MAIL_MAILER=smtp
3435
MAIL_HOST=mailhog

app/Http/Controllers/RegisterController.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ public function show()
1616
'last_name' => ! $isProd ? 'Gordon' : '',
1717
'email' => ! $isProd ? 'test@test.com' : '',
1818
'password' => ! $isProd ? '123456Ab#' : '',
19+
'organisation_name' => ! $isProd ? 'GCPD' : '',
1920
]);
2021
}
2122

@@ -26,6 +27,13 @@ public function store(RegisterStore $request)
2627
$user->password = $request->validated('password');
2728
$user->save();
2829

30+
$user->organisations()->create([
31+
'name' => $request->validated('organisation_name'),
32+
]);
33+
$user->currentOrganisation()->associate($user->organisations->first())->save();
34+
35+
$user->assignRole('user');
36+
2937
\auth()->loginUsingId($user->id);
3038

3139
return \redirect()->route('home');

app/Http/Requests/Register/RegisterStore.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ class RegisterStore extends FormRequest
1010
public function rules()
1111
{
1212
return [
13+
'organisation_name' => ['required', 'string'],
1314
'first_name' => ['required', 'string'],
1415
'last_name' => ['required', 'string'],
1516
'email' => ['required', 'email', 'unique:users'],
@@ -27,6 +28,7 @@ public function rules()
2728
public function attributes()
2829
{
2930
return [
31+
'organisation_name' => 'organisation name',
3032
'first_name' => 'first name',
3133
'last_name' => 'last name',
3234
];

bun.lockb

23.6 KB
Binary file not shown.

composer.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"laravel/horizon": "^5.21",
1212
"laravel/sanctum": "^3.3",
1313
"laravel/tinker": "^2.8",
14+
"predis/predis": "^2.2",
1415
"spatie/laravel-permission": "^5.11",
1516
"tightenco/ziggy": "^1.6"
1617
},
@@ -41,11 +42,13 @@
4142
"build:dev": [
4243
"composer install",
4344
"@artisan:build",
45+
"@php artisan migrate:fresh --seed",
4446
"@assets:build"
4547
],
4648
"build:prod": [
4749
"composer install --no-interaction --prefer-dist --optimize-autoloader",
4850
"@artisan:build",
51+
"@php artisan migrate --force",
4952
"@assets:build"
5053
],
5154
"build:test": [

0 commit comments

Comments
 (0)