editin landing page
This commit is contained in:
parent
0ebb8e142e
commit
863bd1cca9
156
db/migrations/seed_landing_sections_data.php
Normal file
156
db/migrations/seed_landing_sections_data.php
Normal file
@ -0,0 +1,156 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../config.php';
|
||||
$pdo = db();
|
||||
|
||||
$sections = [
|
||||
[
|
||||
'section_type' => 'hero',
|
||||
'title' => 'Fast & Reliable Freight Forwarding',
|
||||
'title_ar' => 'شحن سريع وموثوق',
|
||||
'subtitle' => 'Connect with trusted truck owners and shippers. Streamline your logistics today.',
|
||||
'subtitle_ar' => 'تواصل مع أصحاب الشاحنات والمرسلين الموثوقين. قم بتبسيط لوجستياتك اليوم.',
|
||||
'content' => '',
|
||||
'content_ar' => '',
|
||||
'image_path' => 'uploads/pages/img_69ad2bff407d4.jpg',
|
||||
'layout' => 'text_left',
|
||||
'button_text' => '',
|
||||
'button_text_ar' => '',
|
||||
'button_link' => '',
|
||||
'section_order' => 10,
|
||||
'is_active' => 1
|
||||
],
|
||||
[
|
||||
'section_type' => 'stats',
|
||||
'title' => 'Platform Stats',
|
||||
'title_ar' => 'إحصائيات المنصة',
|
||||
'subtitle' => '',
|
||||
'subtitle_ar' => '',
|
||||
'content' => '',
|
||||
'content_ar' => '',
|
||||
'image_path' => '',
|
||||
'layout' => 'text_left',
|
||||
'button_text' => '',
|
||||
'button_text_ar' => '',
|
||||
'button_link' => '',
|
||||
'section_order' => 20,
|
||||
'is_active' => 1
|
||||
],
|
||||
[
|
||||
'section_type' => 'features',
|
||||
'title' => 'Why Choose Us',
|
||||
'title_ar' => 'لماذا تختارنا ؟',
|
||||
'subtitle' => 'We connect you with the best logistics partners.',
|
||||
'subtitle_ar' => 'نوصلك بأفضل شركاء الخدمات اللوجستية.',
|
||||
'content' => '',
|
||||
'content_ar' => '',
|
||||
'image_path' => '',
|
||||
'layout' => 'text_left',
|
||||
'button_text' => '',
|
||||
'button_text_ar' => '',
|
||||
'button_link' => '',
|
||||
'section_order' => 30,
|
||||
'is_active' => 1
|
||||
],
|
||||
[
|
||||
'section_type' => 'workflow',
|
||||
'title' => 'How it Works',
|
||||
'title_ar' => 'كيف تعمل المنصة',
|
||||
'subtitle' => '',
|
||||
'subtitle_ar' => '',
|
||||
'content' => '',
|
||||
'content_ar' => '',
|
||||
'image_path' => 'uploads/pages/img_69ad2b68c8965.jfif',
|
||||
'layout' => 'text_left',
|
||||
'button_text' => '',
|
||||
'button_text_ar' => '',
|
||||
'button_link' => '',
|
||||
'section_order' => 40,
|
||||
'is_active' => 1
|
||||
],
|
||||
[
|
||||
'section_type' => 'recent_shipments',
|
||||
'title' => 'Recent Shipments',
|
||||
'title_ar' => 'الشحنات الحالية',
|
||||
'subtitle' => '',
|
||||
'subtitle_ar' => '',
|
||||
'content' => '',
|
||||
'content_ar' => '',
|
||||
'image_path' => '',
|
||||
'layout' => 'text_left',
|
||||
'button_text' => '',
|
||||
'button_text_ar' => '',
|
||||
'button_link' => '',
|
||||
'section_order' => 50,
|
||||
'is_active' => 1
|
||||
],
|
||||
[
|
||||
'section_type' => 'faq',
|
||||
'title' => 'Have Questions?',
|
||||
'title_ar' => 'هل لديك تساؤل؟',
|
||||
'subtitle' => 'Check out our Frequently Asked Questions to learn more about how our platform works.',
|
||||
'subtitle_ar' => 'اطلع على أسئلتنا المتكررة لتتعرف أكثر على كيفية عمل منصتنا.',
|
||||
'content' => '',
|
||||
'content_ar' => '',
|
||||
'image_path' => '',
|
||||
'layout' => 'text_left',
|
||||
'button_text' => '',
|
||||
'button_text_ar' => '',
|
||||
'button_link' => '',
|
||||
'section_order' => 60,
|
||||
'is_active' => 1
|
||||
],
|
||||
[
|
||||
'section_type' => 'motivation',
|
||||
'title' => 'Ready to transform your logistics?',
|
||||
'title_ar' => 'هل أنت مستعد لتحويل لوجستياتك؟',
|
||||
'subtitle' => 'Join our platform today to find reliable trucks or secure the best shipments in the market.',
|
||||
'subtitle_ar' => 'انضم إلى منصتنا اليوم للعثور على شاحنات موثوقة أو تأمين أفضل الشحنات في السوق.',
|
||||
'content' => '',
|
||||
'content_ar' => '',
|
||||
'image_path' => '',
|
||||
'layout' => 'text_left',
|
||||
'button_text' => '',
|
||||
'button_text_ar' => '',
|
||||
'button_link' => '',
|
||||
'section_order' => 70,
|
||||
'is_active' => 1
|
||||
]
|
||||
];
|
||||
|
||||
try {
|
||||
$sql = "INSERT INTO landing_sections (section_type, title, title_ar, subtitle, subtitle_ar, content, content_ar, image_path, layout, button_text, button_text_ar, button_link, section_order, is_active) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
|
||||
$stmt = $pdo->prepare($sql);
|
||||
|
||||
foreach ($sections as $section) {
|
||||
// Check if section already exists to avoid duplicates (idempotency)
|
||||
// We check by title and section_type
|
||||
$check = $pdo->prepare("SELECT id FROM landing_sections WHERE section_type = ? AND title = ?");
|
||||
$check->execute([$section['section_type'], $section['title']]);
|
||||
if ($check->fetch()) {
|
||||
echo "Skipping existing section: " . $section['title'] . "\n";
|
||||
continue;
|
||||
}
|
||||
|
||||
$stmt->execute([
|
||||
$section['section_type'],
|
||||
$section['title'],
|
||||
$section['title_ar'],
|
||||
$section['subtitle'],
|
||||
$section['subtitle_ar'],
|
||||
$section['content'],
|
||||
$section['content_ar'],
|
||||
$section['image_path'],
|
||||
$section['layout'],
|
||||
$section['button_text'],
|
||||
$section['button_text_ar'],
|
||||
$section['button_link'],
|
||||
$section['section_order'],
|
||||
$section['is_active']
|
||||
]);
|
||||
echo "Inserted section: " . $section['title'] . "\n";
|
||||
}
|
||||
echo "Default landing sections seeded.\n";
|
||||
} catch (PDOException $e) {
|
||||
echo "Error seeding landing sections: " . $e->getMessage() . "\n";
|
||||
throw $e; // Rethrow to fail migration
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user