@php $dbProfile = $profile ?? (\Illuminate\Support\Facades\Schema::hasTable('profiles') ? \Illuminate\Support\Facades\DB::table('profiles')->first() : null); $fullName = strtoupper(trim($dbProfile->name ?? 'DEFFA HAIDAR DARMANSYAH')); $nameParts = preg_split('/\s+/', $fullName); $firstLine = $nameParts[0] ?? 'DEFFA'; $secondLine = $nameParts[1] ?? 'HAIDAR'; $remainingName = count($nameParts) > 2 ? implode(' ', array_slice($nameParts, 2)) : ''; $headline = strtoupper($dbProfile->headline ?? 'FULL-STACK DEVELOPER'); $location = strtoupper($dbProfile->location ?? 'SUKABUMI, INDONESIA'); $statusText = strtoupper($dbProfile->status_text ?? 'MAHASISWA AKTIF SEMESTER 5'); $gpa = $dbProfile->gpa ?? '3.60'; $bioText = strtoupper($dbProfile->bio ?? 'INFORMATICS ENGINEERING STUDENT & FULL-STACK DEVELOPER. I BUILD ROBUST LARAVEL APPLICATIONS, COMPUTER VISION PIPELINES, AND IOT SYSTEMS — USING AI TO WORK SMARTER, NOT HARDER.'); $contactEmail = $dbProfile->email ?? 'haidarsdeffa@gmail.com'; $githubUrl = $dbProfile->github ?? 'https://github.com/deffaa'; $linkedinUrl = $dbProfile->linkedin ?? 'https://www.linkedin.com/in/deffa-haidar-86b7aa440'; $instagramUrl = $dbProfile->instagram ?? 'https://www.instagram.com/devahaidarr/'; // Main character photo from Admin or public/images/profile.png $rawPhoto = $dbProfile->photo ?? null; if ($rawPhoto && file_exists(public_path('storage/' . ltrim($rawPhoto, '/')))) { $heroImage = asset('storage/' . ltrim($rawPhoto, '/')); } elseif ($rawPhoto && str_starts_with($rawPhoto, 'http')) { $heroImage = $rawPhoto; } elseif (file_exists(public_path('images/profile.png'))) { $heroImage = asset('images/profile.png'); } else { $heroImage = null; } // CV PDF file from Admin or public/cv/ $rawCv = $dbProfile->cv ?? null; if ($rawCv && file_exists(public_path('storage/' . ltrim($rawCv, '/')))) { $cvUrl = asset('storage/' . ltrim($rawCv, '/')); } elseif ($rawCv && str_starts_with($rawCv, 'http')) { $cvUrl = $rawCv; } elseif (file_exists(public_path('cv/CV_Deffa_Haidar.pdf'))) { $cvUrl = asset('cv/CV_Deffa_Haidar.pdf'); } else { $cvUrl = null; } // Projects data from Admin (supports JSON array or comma-separated string) $dbProjects = isset($projects) ? collect($projects) : (\Illuminate\Support\Facades\Schema::hasTable('projects') ? \Illuminate\Support\Facades\DB::table('projects')->orderBy('order')->orderBy('id')->get() : collect()); $projectItems = []; foreach ($dbProjects as $idx => $p) { $rawTags = $p->tags ?? 'LARAVEL 11, PHP, MYSQL'; $decoded = is_string($rawTags) ? json_decode($rawTags, true) : $rawTags; $stackArr = is_array($decoded) ? array_values(array_filter(array_map('trim', $decoded))) : array_values(array_filter(array_map('trim', explode(',', (string) $rawTags)))); $targetUrl = ($p->live_url ?? null) ?: (($p->github_url ?? null) ?: $githubUrl); $projectItems[] = [ 'num' => str_pad((string) ($idx + 1), 2, '0', STR_PAD_LEFT), 'year' => $p->year ?? '2026', 'category' => strtoupper($p->category ?? 'WEB APPLICATION'), 'title' => strtoupper($p->title ?? 'UNTITLED PROJECT'), 'short' => $p->short_description ?? $p->description ?? '', 'full' => $p->description ?? $p->short_description ?? '', 'stack' => $stackArr, 'url' => $targetUrl, 'role' => strtoupper($p->role ?? 'FULL-STACK DEVELOPER'), ]; } // Timelines, Skills & Certificates from Admin $dbTimelines = isset($timelines) ? collect($timelines) : (\Illuminate\Support\Facades\Schema::hasTable('timelines') ? \Illuminate\Support\Facades\DB::table('timelines')->orderBy('order')->orderBy('id')->get() : collect()); $dbSkills = isset($skills) ? collect($skills) : (\Illuminate\Support\Facades\Schema::hasTable('skills') ? \Illuminate\Support\Facades\DB::table('skills')->orderBy('order')->orderBy('id')->get() : collect()); $dbCertificates = isset($certificates) ? collect($certificates) : (\Illuminate\Support\Facades\Schema::hasTable('certificates') ? \Illuminate\Support\Facades\DB::table('certificates')->orderBy('order')->orderBy('id')->get() : collect()); @endphp