-
Notifications
You must be signed in to change notification settings - Fork 0
[55] fix admin name question option #75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
793d3ed
d958860
cc56666
02d8964
c7014a4
e2ab430
6c7eb99
6986207
7bd4375
6b31184
5d72f2f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -428,22 +428,26 @@ protected function runMigrations(): void | |||||
|
|
||||||
| protected function createAdminUser(string $kebabName, string $serviceKey = '', string $serviceName = ''): array | ||||||
| { | ||||||
| $adminEmail = when(empty($serviceKey), "admin@{$kebabName}.com", "admin.{$serviceKey}@{$kebabName}.com"); | ||||||
| $isServiceAdmin = (!empty($serviceKey) && !empty($serviceName)); | ||||||
|
|
||||||
| $adminEmail = when($isServiceAdmin, "admin.{$serviceKey}@{$kebabName}.com", "admin@{$kebabName}.com"); | ||||||
| $defaultPassword = substr(md5(uniqid()), 0, 8); | ||||||
|
|
||||||
| $serviceLabel = when(!empty($serviceName), " for {$serviceName}"); | ||||||
| $serviceLabel = when($isServiceAdmin, " for {$serviceName}"); | ||||||
|
||||||
| $serviceLabel = when($isServiceAdmin, " for {$serviceName}"); | |
| $serviceLabel = when($isServiceAdmin, " for {$serviceName}", ''); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| <?php | ||
|
|
||
| use Illuminate\Database\Migrations\Migration; | ||
| use Illuminate\Support\Facades\App; | ||
| use Illuminate\Support\Facades\DB; | ||
| use Illuminate\Support\Facades\Hash; | ||
|
|
||
| return new class extends Migration | ||
| { | ||
| public function up(): void | ||
| { | ||
| if (!App::environment('testing')) { | ||
| DB::table('admins')->insert([ | ||
| 'email' => 'admin@my-app.com', | ||
| 'password' => Hash::make('123456'), | ||
| ]); | ||
| } | ||
| } | ||
|
|
||
| public function down(): void | ||
| { | ||
| if (!App::environment('testing')) { | ||
| DB::table('admins') | ||
| ->where('email', 'admin@my-app.com') | ||
| ->delete(); | ||
| } | ||
| } | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| <?php | ||
|
|
||
| use Illuminate\Database\Migrations\Migration; | ||
| use Illuminate\Support\Facades\App; | ||
| use Illuminate\Support\Facades\DB; | ||
| use Illuminate\Support\Facades\Hash; | ||
|
|
||
| return new class extends Migration | ||
| { | ||
| public function up(): void | ||
| { | ||
| if (!App::environment('testing')) { | ||
| DB::table('admins')->insert([ | ||
| 'email' => 'admin.nova@my-app.com', | ||
| 'password' => Hash::make('123456'), | ||
| ]); | ||
| } | ||
| } | ||
|
|
||
| public function down(): void | ||
| { | ||
| if (!App::environment('testing')) { | ||
| DB::table('admins') | ||
| ->where('email', 'admin.nova@my-app.com') | ||
| ->delete(); | ||
| } | ||
| } | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| <?php | ||
|
|
||
| use Illuminate\Database\Migrations\Migration; | ||
| use Illuminate\Support\Facades\App; | ||
| use Illuminate\Support\Facades\DB; | ||
| use Illuminate\Support\Facades\Hash; | ||
|
|
||
| return new class extends Migration | ||
| { | ||
| public function up(): void | ||
| { | ||
| if (!App::environment('testing')) { | ||
| DB::table('admins')->insert([ | ||
| 'email' => 'admin.telescope@my-app.com', | ||
| 'password' => Hash::make('654321'), | ||
| ]); | ||
| } | ||
| } | ||
|
|
||
| public function down(): void | ||
| { | ||
| if (!App::environment('testing')) { | ||
| DB::table('admins') | ||
| ->where('email', 'admin.telescope@my-app.com') | ||
| ->delete(); | ||
| } | ||
| } | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| <?php | ||
|
|
||
| use Illuminate\Database\Migrations\Migration; | ||
| use Illuminate\Support\Facades\App; | ||
| use Illuminate\Support\Facades\DB; | ||
| use Illuminate\Support\Facades\Hash; | ||
|
|
||
| return new class extends Migration | ||
| { | ||
| public function up(): void | ||
| { | ||
| if (!App::environment('testing')) { | ||
| DB::table('users')->insert([ | ||
| 'name' => 'Laravel Nova Admin', | ||
| 'email' => 'admin.nova@my-app.com', | ||
| 'password' => Hash::make('123456'), | ||
| 'role_id' => 1, | ||
| ]); | ||
| } | ||
| } | ||
|
|
||
| public function down(): void | ||
| { | ||
| if (!App::environment('testing')) { | ||
| DB::table('users') | ||
| ->where('email', 'admin.nova@my-app.com') | ||
| ->delete(); | ||
| } | ||
| } | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| <?php | ||
|
|
||
| use Illuminate\Database\Migrations\Migration; | ||
| use Illuminate\Support\Facades\App; | ||
| use Illuminate\Support\Facades\DB; | ||
| use Illuminate\Support\Facades\Hash; | ||
|
|
||
| return new class extends Migration | ||
| { | ||
| public function up(): void | ||
| { | ||
| if (!App::environment('testing')) { | ||
| DB::table('users')->insert([ | ||
| 'name' => 'Laravel Telescope Admin', | ||
| 'email' => 'admin.telescope@my-app.com', | ||
| 'password' => Hash::make('654321'), | ||
| 'role_id' => 1, | ||
| ]); | ||
| } | ||
| } | ||
|
|
||
| public function down(): void | ||
| { | ||
| if (!App::environment('testing')) { | ||
| DB::table('users') | ||
| ->where('email', 'admin.telescope@my-app.com') | ||
| ->delete(); | ||
| } | ||
| } | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| <?php | ||
|
|
||
| use Illuminate\Database\Migrations\Migration; | ||
| use Illuminate\Support\Facades\App; | ||
| use Illuminate\Support\Facades\DB; | ||
| use Illuminate\Support\Facades\Hash; | ||
|
|
||
| return new class extends Migration | ||
| { | ||
| public function up(): void | ||
| { | ||
| if (!App::environment('testing')) { | ||
| DB::table('users')->insert([ | ||
| 'name' => 'Admin', | ||
| 'email' => 'admin@my-app.com', | ||
| 'password' => Hash::make('123456'), | ||
| 'role_id' => 1, | ||
| ]); | ||
| } | ||
| } | ||
|
|
||
| public function down(): void | ||
| { | ||
| if (!App::environment('testing')) { | ||
| DB::table('users') | ||
| ->where('email', 'admin@my-app.com') | ||
| ->delete(); | ||
| } | ||
| } | ||
| }; |
Uh oh!
There was an error while loading. Please reload this page.