Skip to content
Merged

Dev #3436

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;

return new class extends Migration {
private const OLD_DEFAULT = 'Explore Career Pathway';

private const NEW_DEFAULT = 'For inspiration from more role models check out <a class="text-dark-blue underline" target="_blank" rel="noopener" href="https://high5girls.dk/bliv-rollemodel-2/">High5Girls rollemodeller - kvinder i STEM-fag</a>';

public function up(): void
{
if (! Schema::hasTable('dream_job_role_models') || ! Schema::hasColumn('dream_job_role_models', 'pathway_title')) {
return;
}

DB::table('dream_job_role_models')
->whereNull('pathway_title')
->orWhere('pathway_title', '')
->orWhere('pathway_title', self::OLD_DEFAULT)
->update(['pathway_title' => self::NEW_DEFAULT]);
}

public function down(): void
{
if (! Schema::hasTable('dream_job_role_models') || ! Schema::hasColumn('dream_job_role_models', 'pathway_title')) {
return;
}

DB::table('dream_job_role_models')
->where('pathway_title', self::NEW_DEFAULT)
->update(['pathway_title' => self::OLD_DEFAULT]);
}
};
4 changes: 3 additions & 1 deletion database/seeders/DreamJobRoleModelSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

class DreamJobRoleModelSeeder extends Seeder
{
private const DEFAULT_PATHWAY_TITLE = 'For inspiration from more role models check out <a class="text-dark-blue underline" target="_blank" rel="noopener" href="https://high5girls.dk/bliv-rollemodel-2/">High5Girls rollemodeller - kvinder i STEM-fag</a>';

/**
* Seed Dream Jobs role models from the current hardcoded defaults.
* Safe to run multiple times (upserts by slug).
Expand Down Expand Up @@ -199,7 +201,7 @@ public function run(): void
'link' => $row['link'],
'video' => $row['video'],
'pathway_map_link' => $row['pathway_map_link'] !== '' ? $row['pathway_map_link'] : null,
'pathway_title' => $row['pathway_title'] ?? 'Explore Career Pathway',
'pathway_title' => $row['pathway_title'] ?? self::DEFAULT_PATHWAY_TITLE,
'pathway_cta_text' => $row['pathway_cta_text'] ?? 'Career Pathway Map',
'position' => $index,
'active' => true,
Expand Down
3 changes: 2 additions & 1 deletion resources/views/static/dream-jobs-in-digital-role.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,8 @@
abort_if(! $item, 404);
}

$item['pathway_title'] = (string) ($item['pathway_title'] ?? 'Explore Career Pathway');
$defaultPathwayTitle = 'For inspiration from more role models check out <a class="text-dark-blue underline" target="_blank" rel="noopener" href="https://high5girls.dk/bliv-rollemodel-2/">High5Girls rollemodeller - kvinder i STEM-fag</a>';
$item['pathway_title'] = (string) ($item['pathway_title'] ?? $defaultPathwayTitle);
$item['pathway_cta_text'] = (string) ($item['pathway_cta_text'] ?? 'Career Pathway Map');

$list = [
Expand Down
Loading