abschlussprojekt-device-man.../device-app/database/seeders/DatabaseSeeder.php
2023-03-30 15:16:38 +02:00

53 lines
1.4 KiB
PHP

<?php
namespace Database\Seeders;
// use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use App\Models\Device;
use App\Models\User;
use Illuminate\Database\Seeder;
use App\Models\OwnerTransaction;
use App\Models\LocationTransaction;
use App\Models\PurchasingInformation;
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',
// ]);
//Device::factory()->has(PurchasingInformation::factory()->count(1))->create();
Device::factory()->count(10)
->has(PurchasingInformation::factory()->count(1), 'purchasing')
->has(LocationTransaction::factory()->count(3), 'locations')
->has(OwnerTransaction::factory()->count(3), 'owners')
->create();
User::create([
'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')
]);
}
}