database seed and some basic frontend
This commit is contained in:
30
device-app/database/factories/DeviceFactory.php
Normal file
30
device-app/database/factories/DeviceFactory.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Device>
|
||||
*/
|
||||
class DeviceFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'device_id' => '1',
|
||||
'title' => 'Test Device One',
|
||||
'device_type' => 'type1',
|
||||
'description' => 'des',
|
||||
'accessories' => 'acc',
|
||||
'rz_username_buyer' => 'rzb',
|
||||
'serial_number' => '123',
|
||||
'image_url' => 'www.url.de'
|
||||
];
|
||||
}
|
||||
}
|
@ -2,6 +2,7 @@
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Faker\Core\Number;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
@ -18,11 +19,11 @@ class UserFactory extends Factory
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'name' => fake()->name(),
|
||||
'email' => fake()->unique()->safeEmail(),
|
||||
'email_verified_at' => now(),
|
||||
'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
|
||||
'remember_token' => Str::random(10),
|
||||
'rz_username' => 'admin',
|
||||
'full_name' => 'Admin',
|
||||
'organisation_unit' => 11111111,
|
||||
'has_admin_privileges' => true,
|
||||
'hashed_password' => 'vollgeheim', // password
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,9 @@
|
||||
namespace Database\Seeders;
|
||||
|
||||
// use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
|
||||
use App\Models\Device;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class DatabaseSeeder extends Seeder
|
||||
@ -18,5 +21,33 @@ class DatabaseSeeder extends Seeder
|
||||
// 'name' => 'Test User',
|
||||
// 'email' => 'test@example.com',
|
||||
// ]);
|
||||
|
||||
Device::factory()->create([
|
||||
'device_id' => '1',
|
||||
'title' => 'Test Device One',
|
||||
'device_type' => 'type1',
|
||||
'description' => 'des',
|
||||
'accessories' => 'acc',
|
||||
'rz_username_buyer' => 'rzb',
|
||||
'serial_number' => '123',
|
||||
'image_url' => 'www.url.de'
|
||||
]);
|
||||
|
||||
//User::create([
|
||||
// [
|
||||
// 'rz_username' => 'admin',
|
||||
// 'full_name' => 'Admin',
|
||||
// 'organisation_unit' => '11111111',
|
||||
// 'has_admin_privileges' => true,
|
||||
// 'hashed_password' => 'vollgeheim'
|
||||
// ],
|
||||
// [
|
||||
// 'rz_username' => 'user',
|
||||
// 'full_name' => 'User',
|
||||
// 'organisation_unit' => '66666666',
|
||||
// 'has_admin_privileges' => false,
|
||||
// 'hashed_password' => 'test123'
|
||||
// ]
|
||||
//]);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user