Skip to content

Commit 667f980

Browse files
committed
add default seeder
Took 50 seconds
1 parent 452df12 commit 667f980

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ This package is designed to be used on a fresh Laravel project.
2929
- [x] Localize all files
3030
- [ ] Use json files instead of split translations
3131
- [ ] Add an example CRUD
32-
- [ ] Add UserSeeder with a default admin account
32+
- [x] Add UserSeeder with a default admin account
3333
- [ ] Add option to enable/disable locales
3434
- [ ] Update web.php with groups
3535
- [ ] Include laravel ide helper support
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
3+
namespace Database\Seeders;
4+
5+
// use Illuminate\Database\Console\Seeds\WithoutModelEvents;
6+
use Illuminate\Database\Seeder;
7+
8+
class DatabaseSeeder extends Seeder
9+
{
10+
/**
11+
* Seed the application's database.
12+
*
13+
* @return void
14+
*/
15+
public function run()
16+
{
17+
// \App\Models\User::factory(10)->create();
18+
19+
\App\Models\User::factory()->create([
20+
'name' => 'Administrator',
21+
'email' => '[email protected]',
22+
]);
23+
}
24+
}

src/Commands/InstallCommand.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ public function handle(): int
7676
copy(__DIR__ . '/../../resources/middleware/HandleInertiaRequests.php', base_path('app/Http/Middleware/HandleInertiaRequests.php'));
7777
copy(__DIR__ . '/../../routes/web.php', base_path('routes/web.php'));
7878
copy(__DIR__ . '/../../app/Http/Middleware/SetLocale.php', app_path('Http/Middleware/SetLocale.php'));
79+
copy(__DIR__ . '/../../database/seeders/DatabaseSeeder.php', base_path('database/seeders/DatabaseSeeder.php'));
7980

8081
$this->installMiddlewareAfter('SubstituteBindings::class', '\App\Http\Middleware\SetLocale::class');
8182
$this->info('Your application is ready!');

0 commit comments

Comments
 (0)