V2, better design, more functionalities.

This commit is contained in:
Roberto Guagliardo
2025-07-09 01:22:29 +02:00
parent b324c030f4
commit 2c5d7102ab
87 changed files with 2273 additions and 178 deletions

View File

@@ -0,0 +1,38 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\File;
class EducationSeeder extends Seeder
{
public function run(): void
{
$path = database_path('data/education.json');
if (!File::exists($path)) {
return;
}
// Verwijder alle bestaande records
DB::table('education')->truncate();
// Laad nieuwe data in
$data = json_decode(File::get($path), true);
foreach ($data as $item) {
DB::table('education')->insert([
'id' => $item['id'],
'opleiding' => $item['opleiding'],
'instituut' => $item['instituut'],
'startdatum' => $item['startdatum'],
'einddatum' => $item['einddatum'] ?? null,
'beschrijving' => $item['beschrijving'],
'created_at' => $item['created_at'] ?? now(),
'updated_at' => $item['updated_at'] ?? now(),
]);
}
}
}

View File

@@ -0,0 +1,49 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\File;
class MediaSeeder extends Seeder
{
public function run(): void
{
$path = database_path('data/media.json');
if (!File::exists($path)) {
$this->command->warn("media.json niet gevonden, seeding overgeslagen.");
return;
}
DB::table('media')->truncate();
$data = json_decode(File::get($path), true);
foreach ($data as $item) {
DB::table('media')->insert([
// 'id' => $item['id'],
'model_type' => $item['model_type'],
'model_id' => $item['model_id'],
'uuid' => $item['uuid'],
'collection_name' => $item['collection_name'],
'name' => $item['name'],
'file_name' => $item['file_name'],
'mime_type' => $item['mime_type'],
'disk' => $item['disk'],
'conversions_disk' => $item['conversions_disk'],
'size' => $item['size'],
'manipulations' => json_encode($item['manipulations']),
'custom_properties' => json_encode($item['custom_properties']),
'generated_conversions' => json_encode($item['generated_conversions']),
'responsive_images' => json_encode($item['responsive_images']),
'order_column' => $item['order_column'] ?? null,
'created_at' => $item['created_at'] ?? now(),
'updated_at' => $item['updated_at'] ?? now(),
]);
}
$this->command->info('Media succesvol geïmporteerd.');
}
}

View File

@@ -0,0 +1,38 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use App\Models\Personalia;
use Illuminate\Support\Facades\File;
class PersonaliaSeeder extends Seeder
{
public function run(): void
{
$path = database_path('data/personalia.json');
if (!File::exists($path)) {
$this->command->warn("Bestand {$path} bestaat niet, seeder overgeslagen.");
return;
}
// Leegmaken van de bestaande data
Personalia::truncate();
// JSON inladen
$data = json_decode(File::get($path), true);
// Records toevoegen
foreach ($data as $item) {
Personalia::create([
'key' => $item['key'],
'value' => $item['value'],
'hidden' => $item['hidden'],
'icon' => $item['icon'],
]);
}
$this->command->info(count($data) . ' personalia-records geïmporteerd.');
}
}

View File

@@ -0,0 +1,37 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use App\Models\Skill;
use Illuminate\Support\Facades\File;
class SkillSeeder extends Seeder
{
public function run(): void
{
$path = database_path('data/skills.json');
if (!File::exists($path)) {
return;
}
// Verwijder alle bestaande records
Skill::truncate();
// Laad en decode de JSON
$data = json_decode(File::get($path), true);
// Voeg nieuwe data toe
foreach ($data as $item) {
Skill::create([
'type' => $item['type'],
'title' => $item['title'],
'description' => $item['description'] ?? null,
'rating' => $item['rating'] ?? null,
'created_at' => $item['created_at'] ?? now(),
'updated_at' => $item['updated_at'] ?? now(),
]);
}
}
}

View File

@@ -0,0 +1,45 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use App\Models\WorkExperience;
use Illuminate\Support\Facades\File;
class WorkExperienceSeeder extends Seeder
{
public function run(): void
{
$jsonPath = database_path('data/work_experiences.json');
// Bestaat het JSON-bestand?
if (!File::exists($jsonPath)) {
$this->command->warn("❌ Bestand $jsonPath niet gevonden. Seeder overgeslagen.");
return;
}
// Verwijder bestaande records
WorkExperience::truncate();
// Lees en decode de JSON
$json = File::get($jsonPath);
$data = json_decode($json, true);
// Voeg werkervaringen toe
foreach ($data as $item) {
WorkExperience::updateOrCreate(
[
'werkgever' => $item['werkgever'],
'functie' => $item['functie'],
'startdatum' => $item['startdatum'],
],
[
'einddatum' => $item['einddatum'] ?? null,
'beschrijving' => $item['beschrijving'],
]
);
}
$this->command->info("✅ Werkervaringen succesvol geïmporteerd.");
}
}