2023-03-21 19:54:30 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Database\Seeders;
|
|
|
|
|
|
|
|
// use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
2023-03-23 21:50:31 +01:00
|
|
|
|
|
|
|
use App\Models\Device;
|
|
|
|
use App\Models\User;
|
2023-03-21 19:54:30 +01:00
|
|
|
use Illuminate\Database\Seeder;
|
2023-03-29 22:32:49 +02:00
|
|
|
use App\Models\OwnerTransaction;
|
|
|
|
use App\Models\LocationTransaction;
|
|
|
|
use App\Models\PurchasingInformation;
|
2023-03-21 19:54:30 +01:00
|
|
|
|
|
|
|
class DatabaseSeeder extends Seeder
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Seed the application's database.
|
|
|
|
*/
|
|
|
|
public function run(): void
|
|
|
|
{
|
|
|
|
// \App\Models\User::factory(10)->create();
|
|
|
|
|
|
|
|
// \App\Models\User::factory()->create([
|
|
|
|
// 'name' => 'Test User',
|
|
|
|
// 'email' => 'test@example.com',
|
|
|
|
// ]);
|
2023-03-23 21:50:31 +01:00
|
|
|
|
2023-03-30 15:16:38 +02:00
|
|
|
//Device::factory()->has(PurchasingInformation::factory()->count(1))->create();
|
2023-03-24 14:11:09 +01:00
|
|
|
|
2023-03-30 15:16:38 +02:00
|
|
|
Device::factory()->count(10)
|
|
|
|
->has(PurchasingInformation::factory()->count(1), 'purchasing')
|
|
|
|
->has(LocationTransaction::factory()->count(3), 'locations')
|
|
|
|
->has(OwnerTransaction::factory()->count(3), 'owners')
|
|
|
|
->create();
|
2023-03-27 15:29:49 +02:00
|
|
|
|
2023-03-30 15:16:38 +02:00
|
|
|
User::create([
|
2023-03-27 15:29:49 +02:00
|
|
|
'rz_username' => 'admin',
|
|
|
|
'full_name' => 'Admin',
|
|
|
|
'organisation_unit' => '11111111',
|
|
|
|
'has_admin_privileges' => true,
|
|
|
|
'hashed_password' => bcrypt('vollgeheim')
|
|
|
|
]);
|
|
|
|
|
|
|
|
User::create([
|
|
|
|
'rz_username' => 'user',
|
|
|
|
'full_name' => 'User',
|
|
|
|
'organisation_unit' => '66666666',
|
|
|
|
'has_admin_privileges' => false,
|
|
|
|
'hashed_password' => bcrypt('test123')
|
|
|
|
]);
|
2023-03-21 19:54:30 +01:00
|
|
|
}
|
|
|
|
}
|