b2in/database/seeders/CmsProjectSeeder.php
2026-04-10 17:18:17 +02:00

169 lines
7.9 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
namespace Database\Seeders;
use App\Models\CmsProject;
use Illuminate\Database\Seeder;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\Lang;
class CmsProjectSeeder extends Seeder
{
private const PROJECT_SLUG = 'azizi-creek-views-4';
/**
* Seed the CMS projects table from resources/lang/{locale}/b2in.php
* (themes.b2in.immobilien_projects.projects.{slug}).
*
* Zusätzliche Blöcke investor_trust / furniture_benefit sind in den Lang-Dateien
* nicht enthalten und werden hier mit DE/EN ergänzt.
*/
public function run(): void
{
foreach ($this->getProjects() as $data) {
CmsProject::query()->updateOrCreate(
['slug' => $data['slug']],
$data,
);
}
}
/**
* @return array<int, array<string, mixed>>
*/
private function getProjects(): array
{
$key = 'b2in.themes.b2in.immobilien_projects.projects.'.self::PROJECT_SLUG;
/** @var array<string, mixed> $de */
$de = Lang::get($key, [], 'de');
/** @var array<string, mixed> $en */
$en = Lang::get($key, [], 'en');
if ($de === [] || ! is_array($de)) {
return [];
}
if (! is_array($en)) {
$en = [];
}
$launchDate = isset($de['launch_date']) && is_string($de['launch_date'])
? Carbon::createFromFormat('d.m.Y', $de['launch_date'])
: Carbon::create(2026, 3, 3);
$extras = $this->projectTrustAndFurnitureBlocks();
return [
[
'slug' => self::PROJECT_SLUG,
'title' => [
'de' => (string) ($de['title'] ?? ''),
'en' => (string) ($en['title'] ?? $de['title'] ?? ''),
],
'location' => [
'de' => (string) ($de['location'] ?? ''),
'en' => (string) ($en['location'] ?? $de['location'] ?? ''),
],
'status' => (string) ($de['status'] ?? 'NEW LAUNCH'),
'launch_date' => $launchDate,
'price_from_aed' => 1_125_000,
'currency' => 'AED',
'image' => (string) ($de['image'] ?? ''),
'highlights' => [
'de' => is_array($de['highlights'] ?? null) ? $de['highlights'] : [],
'en' => is_array($en['highlights'] ?? null) ? $en['highlights'] : [],
],
'quick_facts' => is_array($de['quick_facts'] ?? null) ? $de['quick_facts'] : [],
'investment_case' => [
'de' => is_array($de['investment_case'] ?? null) ? $de['investment_case'] : [],
'en' => is_array($en['investment_case'] ?? null) ? $en['investment_case'] : [],
],
'gallery' => is_array($de['gallery'] ?? null) ? $de['gallery'] : [],
'location_info' => [
'de' => is_array($de['location_info'] ?? null) ? $de['location_info'] : [],
'en' => is_array($en['location_info'] ?? null) ? $en['location_info'] : [],
],
'contact' => [
'de' => is_array($de['contact'] ?? null) ? $de['contact'] : [],
'en' => is_array($en['contact'] ?? null) ? $en['contact'] : [],
],
'investor_trust' => $extras['investor_trust'],
'furniture_benefit' => $extras['furniture_benefit'],
'is_published' => true,
'order' => 0,
],
];
}
/**
* @return array{investor_trust: array<string, array<string, mixed>>, furniture_benefit: array<string, array<string, mixed>>}
*/
private function projectTrustAndFurnitureBlocks(): array
{
return [
'investor_trust' => [
'de' => [
'title' => 'Maximale Sicherheit für Ihr Investment',
'intro' => 'Der Kaufprozess in Dubai ist durch strenge staatliche Regularien international führend im Investorenschutz.',
'columns' => [
[
'icon' => 'heroicon-o-lock-closed',
'title' => 'Staatliches Escrow-System',
'text' => 'Ihre Zahlungen fließen nicht an den Bauträger, sondern auf speziell regulierte Treuhandkonten der RERA (Real Estate Regulatory Agency).',
],
[
'icon' => 'heroicon-o-building-library',
'title' => 'Strenge DLD-Kontrolle',
'text' => 'Jeder Kaufvertrag (SPA) wird offiziell beim Dubai Land Department registriert. Lückenlose behördliche Überwachung jedes Bauprojekts.',
],
[
'icon' => 'heroicon-o-chart-bar',
'title' => 'Transparente Planbarkeit',
'text' => 'Gelder werden nur streng nach zertifiziertem Baufortschritt freigegeben. Eine Zweckentfremdung Ihres Kapitals ist gesetzlich ausgeschlossen.',
],
],
'cta_url' => '/magazin/1',
'cta_label' => 'Deep Dive: Erfahren Sie im Magazin im Detail, wie das Escrow-System in Dubai Sie als Käufer schützt',
],
'en' => [
'title' => 'Maximum security for your investment',
'intro' => 'The purchase process in Dubai is among the worlds most investor-protective, thanks to strict government regulation.',
'columns' => [
[
'icon' => 'heroicon-o-lock-closed',
'title' => 'Government Escrow system',
'text' => 'Your payments do not go to the developer; they are held in specially regulated trust accounts with the RERA (Real Estate Regulatory Agency).',
],
[
'icon' => 'heroicon-o-building-library',
'title' => 'Strict DLD oversight',
'text' => 'Every purchase contract (SPA) is officially registered with the Dubai Land Department. Every construction project is monitored end-to-end.',
],
[
'icon' => 'heroicon-o-chart-bar',
'title' => 'Transparent planning',
'text' => 'Funds are released only according to certified construction progress. Misuse of your capital is legally ruled out.',
],
],
'cta_url' => '/magazin/1',
'cta_label' => 'Deep dive: read in the magazine how Dubais Escrow system protects you as a buyer',
],
],
'furniture_benefit' => [
'de' => [
'title' => 'Ihr Investment, <span class="text-secondary">Ihr Vorteil</span>',
'text' => 'Als Käufer einer B2in-Immobilie erhalten Sie exklusiven Insider-Zugang zu unserem B2in-Möbelnetzwerk. Richten Sie Ihre Immobilie zu unschlagbaren Partner-Konditionen ein.',
'button_text' => 'Mehr zum B2in-Netzwerk',
'button_link' => '/netzwerk',
],
'en' => [
'title' => 'Your investment, <span class="text-secondary">your advantage</span>',
'text' => 'As a buyer of a B2in property, you receive exclusive insider access to our B2in furniture network. Furnish your property at unbeatable partner conditions.',
'button_text' => 'Learn more about the B2in network',
'button_link' => '/netzwerk',
],
],
];
}
}