Преглед на файлове

done pull del index database

Vitalik преди 1 месец
родител
ревизия
6c7b3a1e2d

+ 4 - 0
.gitignore

@@ -5,6 +5,10 @@ database/database.db
 uploads/*
 !uploads/.gitkeep
 
+# Media
+media/*
+!media/.gitkeep
+
 # Logs
 *.log
 

+ 47 - 6
bin/migrate.php

@@ -86,11 +86,11 @@ try {
         ['grupa' => 'content', 'name' => 'listing', 'value' => 'Top Rated Casinos'],
         ['grupa' => 'content', 'name' => 'content_btn', 'value' => 'Play Now'],
         ['grupa' => 'content', 'name' => 'hide-btns', 'value' => '0'],
-        ['grupa' => 'content', 'name' => 'header-logo', 'value' => '{"src":"uploads/logo.png","title":"Amazing Casino Logo","alt":"Amazing Casino - Best Online Gaming"}'],
-        ['grupa' => 'content', 'name' => 'banner-logo', 'value' => '{"src":"uploads/banner.jpg","title":"Welcome Bonus Banner","alt":"Get 200% Welcome Bonus","width":"800","height":"400"}'],
-        ['grupa' => 'content', 'name' => 'footer-logo', 'value' => '{"src":"uploads/footer-logo.png","title":"Footer Logo","alt":"Amazing Casino Footer"}'],
-        ['grupa' => 'content', 'name' => 'favicon', 'value' => 'uploads/favicon.ico'],
-        ['grupa' => 'content', 'name' => 'author-img', 'value' => 'uploads/author.jpg'],
+        ['grupa' => 'content', 'name' => 'header-logo', 'value' => '{"src":"media/logo.png","title":"Amazing Casino Logo","alt":"Amazing Casino - Best Online Gaming"}'],
+        ['grupa' => 'content', 'name' => 'banner-logo', 'value' => '{"src":"media/banner.jpg","title":"Welcome Bonus Banner","alt":"Get 200% Welcome Bonus","width":"800","height":"400"}'],
+        ['grupa' => 'content', 'name' => 'footer-logo', 'value' => '{"src":"media/footer-logo.png","title":"Footer Logo","alt":"Amazing Casino Footer"}'],
+        ['grupa' => 'content', 'name' => 'favicon', 'value' => 'media/favicon.ico'],
+        ['grupa' => 'content', 'name' => 'author-img', 'value' => 'media/author.jpg'],
         ['grupa' => 'content', 'name' => 'hash', 'value' => 'ac123main'],
         ['grupa' => 'content', 'name' => 'hash-1', 'value' => 'ac123promo'],
         ['grupa' => 'content', 'name' => 'hash-2', 'value' => 'ac123bonus'],
@@ -129,7 +129,7 @@ try {
         ['grupa' => 'seo', 'name' => 'og-title', 'value' => 'Amazing Casino - Win Big with Our Casino Games'],
         ['grupa' => 'seo', 'name' => 'og-description', 'value' => 'Experience the thrill of premium casino games with Amazing Casino. Get your 200% welcome bonus today!'],
         ['grupa' => 'seo', 'name' => 'og-locale', 'value' => 'en_US'],
-        ['grupa' => 'seo', 'name' => 'og-image', 'value' => 'uploads/og-image.jpg'],
+        ['grupa' => 'seo', 'name' => 'og-image', 'value' => 'media/og-image.jpg'],
         ['grupa' => 'seo', 'name' => 'lang', 'value' => 'en'],
         ['grupa' => 'seo', 'name' => 'lang-page', 'value' => 'en-US'],
         ['grupa' => 'seo', 'name' => 'hreflang', 'value' => '[{"hreflang":"en","href":"https://amazing-casino.com/en/"},{"hreflang":"es","href":"https://amazing-casino.com/es/"},{"hreflang":"fr","href":"https://amazing-casino.com/fr/"},{"hreflang":"x-default","href":"https://amazing-casino.com/"}]'],
@@ -174,6 +174,47 @@ try {
     $db->execute($seoMetasIndexSQL);
     echo "✓ SEO Metas table index checked/created\n";
     
+    // Migration: Create faqs table
+    $faqsTableSQL = "
+        CREATE TABLE IF NOT EXISTS faqs (
+        id INTEGER PRIMARY KEY AUTOINCREMENT,
+        faqable_type VARCHAR(255) NOT NULL,
+        faqable_id INTEGER NOT NULL,
+        title VARCHAR(255) NULL,
+        extra_fields JSON NULL,
+        created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
+        updated_at DATETIME DEFAULT CURRENT_TIMESTAMP
+    )";
+    $db->execute($faqsTableSQL);
+    echo "✓ FAQs table checked/created\n";
+    
+    // Create indexes for faqs
+    $faqsIndexSQL = "CREATE INDEX IF NOT EXISTS idx_faqs_faqable ON faqs(faqable_type, faqable_id)";
+    $db->execute($faqsIndexSQL);
+    echo "✓ FAQs table index checked/created\n";
+    
+    // Migration: Create slots table
+    $slotsTableSQL = "
+        CREATE TABLE IF NOT EXISTS slots (
+        id INTEGER PRIMARY KEY AUTOINCREMENT,
+        name VARCHAR(255) NOT NULL,
+        image VARCHAR(255) NULL,
+        provider VARCHAR(255) NULL,
+        rtp DECIMAL(5,2) NULL,
+        demo_url VARCHAR(500) NULL,
+        created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
+        updated_at DATETIME DEFAULT CURRENT_TIMESTAMP
+    )";
+    $db->execute($slotsTableSQL);
+    echo "✓ Slots table checked/created\n";
+    
+    // Create indexes for slots
+    $slotsNameIndexSQL = "CREATE INDEX IF NOT EXISTS idx_slots_name ON slots(name)";
+    $db->execute($slotsNameIndexSQL);
+    $slotsProviderIndexSQL = "CREATE INDEX IF NOT EXISTS idx_slots_provider ON slots(provider)";
+    $db->execute($slotsProviderIndexSQL);
+    echo "✓ Slots table indexes checked/created\n";
+    
     echo "Migration completed successfully!\n";
     
 } catch (Exception $e) {

+ 1 - 1
config/src.php

@@ -4,7 +4,7 @@ class Config
     const PATH = [
         'root' => __DIR__.'/..',
         'src' => __DIR__.'/../src',
-        'storage' => __DIR__.'/../public/uploads',
+        'storage' => __DIR__.'/../public/media',
         'resources' => __DIR__.'/../resources',
         'view' => __DIR__.'/../resources/view',
         'public' => __DIR__.'/../public',

BIN
database/database.db


+ 1 - 0
public/index.php

@@ -7,6 +7,7 @@ $page = match (true) {
   ('/' === $requestUri) => 'home.php',
   ('/admin/' === $requestUri) => 'admin/index.php',
   ('/admin/pages/' === $requestUri) => 'admin/pages.php',
+  ('/admin/slots/' === $requestUri) => 'admin/slots.php',
   ('/verstka/' === $requestUri) => 'verstka.php',
   (preg_match('#^/redirect/([\w-]+)/$#', $requestUri, $matches) === 1) => 'redirect.php',
   default => '404.php',

BIN
public/uploads/3861988_bf23eec6.jpg


BIN
public/uploads/Capture-2025-05-13-130007.png


BIN
public/uploads/Capture-2025-06-26-151206.png


BIN
public/uploads/Velobet.png


BIN
public/uploads/backgroun-calc-baner.jpg


+ 67 - 0
resources/view/admin/pages/form.php

@@ -111,6 +111,14 @@ ob_start();
                                         </svg>
                                         Content
                                     </button>
+                                    <button type="button" @click="activePageTab = 'faq'" 
+                                            :class="activePageTab === 'faq' ? 'border-blue-500 text-blue-600' : 'border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300'"
+                                            class="py-4 px-1 border-b-2 font-medium text-sm whitespace-nowrap transition-colors">
+                                        <svg class="w-5 h-5 inline mr-2" fill="currentColor" viewBox="0 0 20 20">
+                                            <path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-3a1 1 0 00-.867.5 1 1 0 11-1.731-1A3 3 0 0113 8a3.001 3.001 0 01-2 2.83V11a1 1 0 11-2 0v-1a1 1 0 011-1 1 1 0 100-2zm0 8a1 1 0 100-2 1 1 0 000 2z" clip-rule="evenodd"/>
+                                        </svg>
+                                        FAQ
+                                    </button>
                                     <button type="button" @click="activePageTab = 'seo'" 
                                             :class="activePageTab === 'seo' ? 'border-blue-500 text-blue-600' : 'border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300'"
                                             class="py-4 px-1 border-b-2 font-medium text-sm whitespace-nowrap transition-colors">
@@ -155,6 +163,65 @@ ob_start();
                             </div>
                         </div>
 
+                        <!-- FAQ Tab -->
+                        <?php 
+                        $faqItemsJson = !empty($faqs['extra_fields']) ? htmlspecialchars(json_encode($faqs['extra_fields']), ENT_QUOTES, 'UTF-8') : '[]';
+                        ?>
+                        <div x-show="activePageTab === 'faq'" 
+                             x-data='{ faqItems: <?= $faqItemsJson ?> }'
+                             x-transition:enter="transition ease-out duration-200"
+                             x-transition:enter-start="opacity-0"
+                             x-transition:enter-end="opacity-100"
+                             x-transition:leave="transition ease-in duration-150"
+                             x-transition:leave-start="opacity-100"
+                             x-transition:leave-end="opacity-0"
+                             class="bg-white rounded-lg shadow-sm mt-6">
+                            <div class="p-6">
+                                <h3 class="text-lg font-medium text-gray-900 mb-6">FAQ Management</h3>
+                                
+                                <div class="mb-6">
+                                    <label for="faq_title" class="block text-sm font-medium text-gray-700 mb-2">FAQ Section Title</label>
+                                    <input type="text" name="faq[title]" id="faq_title" 
+                                           value="<?= htmlspecialchars($faqs['title'] ?? '') ?>"
+                                           placeholder="Enter FAQ section title..." 
+                                           class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
+                                </div>
+                                
+                                <div class="space-y-4">
+                                    <template x-for="(item, index) in faqItems" :key="index">
+                                        <div class="faq-item bg-gray-50 rounded-lg p-4 border border-gray-200">
+                                            <div class="space-y-4">
+                                                <div>
+                                                    <label class="block text-sm font-medium text-gray-700 mb-2">Question</label>
+                                                    <input type="text" :name="`faq[items][${index}][question]`" x-model="item.question"
+                                                           placeholder="Enter FAQ question..." 
+                                                           class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
+                                                </div>
+                                                <div>
+                                                    <label class="block text-sm font-medium text-gray-700 mb-2">Answer</label>
+                                                    <textarea :name="`faq[items][${index}][answer]`" x-model="item.answer" rows="3"
+                                                              placeholder="Enter FAQ answer..."
+                                                              class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500"></textarea>
+                                                </div>
+                                                <button type="button" @click="faqItems.splice(index, 1)"
+                                                        class="inline-flex items-center px-3 py-2 border border-transparent text-sm font-medium rounded-md text-white bg-red-600 hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500">
+                                                    Remove
+                                                </button>
+                                            </div>
+                                        </div>
+                                    </template>
+                                    
+                                    <button type="button" @click="faqItems.push({ question: '', answer: '' })"
+                                            class="inline-flex items-center px-4 py-2 border border-gray-300 shadow-sm text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500">
+                                        <svg class="w-5 h-5 mr-2" fill="currentColor" viewBox="0 0 20 20">
+                                            <path fill-rule="evenodd" d="M10 3a1 1 0 011 1v5h5a1 1 0 110 2h-5v5a1 1 0 11-2 0v-5H4a1 1 0 110-2h5V4a1 1 0 011-1z" clip-rule="evenodd"/>
+                                        </svg>
+                                        Add FAQ Item
+                                    </button>
+                                </div>
+                            </div>
+                        </div>
+
                         <!-- SEO Tab -->
                         <div x-show="activePageTab === 'seo'" 
                              x-transition:enter="transition ease-out duration-200"

+ 8 - 1
resources/view/admin/partials/sidebar.php

@@ -8,8 +8,9 @@
         <div class="px-4 space-y-1">
 <?php
 $currentUri = $_SERVER['REQUEST_URI'];
-$isIndex = (strpos($currentUri, '/admin/pages/') === false && strpos($currentUri, '/admin/') !== false);
+$isIndex = (strpos($currentUri, '/admin/pages/') === false && strpos($currentUri, '/admin/slots/') === false && strpos($currentUri, '/admin/') !== false);
 $isPages = (strpos($currentUri, '/admin/pages/') !== false);
+$isSlots = (strpos($currentUri, '/admin/slots/') !== false);
 ?>
             <a href="/admin/" class="<?= $isIndex ? 'group flex items-center px-3 py-2 text-sm font-medium rounded-lg text-blue-700 bg-blue-50 border-r-4 border-blue-700' : 'group flex items-center px-3 py-2 text-sm font-medium rounded-lg text-gray-600 hover:text-gray-900 hover:bg-gray-50 transition-colors' ?>">
                 <svg class="mr-3 h-5 w-5" fill="currentColor" viewBox="0 0 20 20">
@@ -23,6 +24,12 @@ $isPages = (strpos($currentUri, '/admin/pages/') !== false);
                 </svg>
                 Dynamic Pages
             </a>
+            <a href="/admin/slots/" class="<?= $isSlots ? 'group flex items-center px-3 py-2 text-sm font-medium rounded-lg text-blue-700 bg-blue-50 border-r-4 border-blue-700' : 'group flex items-center px-3 py-2 text-sm font-medium rounded-lg text-gray-600 hover:text-gray-900 hover:bg-gray-50 transition-colors' ?>">
+                <svg class="mr-3 h-5 w-5" fill="currentColor" viewBox="0 0 20 20">
+                    <path fill-rule="evenodd" d="M11.3 1.046A1 1 0 0112 2v5h4a1 1 0 01.82 1.573l-7 10A1 1 0 018 18v-5H4a1 1 0 01-.82-1.573l7-10a1 1 0 011.12-.38z" clip-rule="evenodd"/>
+                </svg>
+                Casino Slots
+            </a>
         </div>
     </nav>
 </div>

+ 147 - 0
resources/view/admin/slots/form.php

@@ -0,0 +1,147 @@
+<?php
+ob_start();
+?>
+
+<div class="min-h-screen bg-gray-50 py-6">
+    <div class="max-w-4xl mx-auto px-4 sm:px-6 lg:px-8">
+        <!-- Header -->
+        <div class="mb-8">
+            <div class="md:flex md:items-center md:justify-between">
+                <div class="flex-1 min-w-0">
+                    <h2 class="text-2xl font-bold leading-7 text-gray-900 sm:text-3xl sm:truncate">
+                        <?= $action === 'create' ? 'Add New Slot' : 'Edit Slot' ?>
+                    </h2>
+                    <p class="mt-1 text-sm text-gray-500">
+                        <?= $action === 'create' ? 'Create a new casino slot' : 'Update slot information' ?>
+                    </p>
+                </div>
+            </div>
+        </div>
+
+        <!-- Success/Error Messages -->
+        <?php if (isset($success)): ?>
+            <div class="mb-6 bg-green-50 border border-green-200 rounded-md p-4">
+                <div class="flex">
+                    <div class="flex-shrink-0">
+                        <svg class="h-5 w-5 text-green-400" viewBox="0 0 20 20" fill="currentColor">
+                            <path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd"/>
+                        </svg>
+                    </div>
+                    <div class="ml-3">
+                        <p class="text-sm font-medium text-green-800"><?= htmlspecialchars($success) ?></p>
+                    </div>
+                </div>
+            </div>
+        <?php endif; ?>
+
+        <?php if (isset($error)): ?>
+            <div class="mb-6 bg-red-50 border border-red-200 rounded-md p-4">
+                <div class="flex">
+                    <div class="flex-shrink-0">
+                        <svg class="h-5 w-5 text-red-400" viewBox="0 0 20 20" fill="currentColor">
+                            <path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z" clip-rule="evenodd"/>
+                        </svg>
+                    </div>
+                    <div class="ml-3">
+                        <p class="text-sm font-medium text-red-800"><?= htmlspecialchars($error) ?></p>
+                    </div>
+                </div>
+            </div>
+        <?php endif; ?>
+
+        <!-- Form -->
+        <form method="POST" enctype="multipart/form-data" class="space-y-6">
+            <input type="hidden" name="action" value="<?= $action ?>">
+            <?php if ($action === 'edit'): ?>
+                <input type="hidden" name="id" value="<?= $slot['id'] ?>">
+            <?php endif; ?>
+
+            <div class="bg-white shadow rounded-lg">
+                <div class="px-6 py-4 border-b border-gray-200">
+                    <h3 class="text-lg font-medium text-gray-900">Slot Information</h3>
+                    <p class="mt-1 text-sm text-gray-500">Basic information about the slot game.</p>
+                </div>
+
+                <div class="px-6 py-4 space-y-6">
+                    <!-- Slot Name -->
+                    <div>
+                        <label for="name" class="block text-sm font-medium text-gray-700 mb-2">Slot Name *</label>
+                        <input type="text" name="name" id="name" required
+                               value="<?= htmlspecialchars($slot['name'] ?? '') ?>" 
+                               class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500"
+                               placeholder="Enter slot name">
+                    </div>
+
+                    <!-- Provider -->
+                    <div>
+                        <label for="provider" class="block text-sm font-medium text-gray-700 mb-2">Provider</label>
+                        <input type="text" name="provider" id="provider"
+                               value="<?= htmlspecialchars($slot['provider'] ?? '') ?>" 
+                               class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500"
+                               placeholder="e.g. NetEnt, Microgaming, Pragmatic Play">
+                    </div>
+
+                    <!-- RTP -->
+                    <div>
+                        <label for="rtp" class="block text-sm font-medium text-gray-700 mb-2">RTP (%)</label>
+                        <input type="number" name="rtp" id="rtp" step="0.01" min="0" max="100"
+                               value="<?= htmlspecialchars($slot['rtp'] ?? '') ?>" 
+                               class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500"
+                               placeholder="e.g. 96.50">
+                        <p class="mt-1 text-xs text-gray-500">Return to Player percentage (e.g. 96.50 for 96.50%)</p>
+                    </div>
+
+                    <!-- Image Upload -->
+                    <div>
+                        <label for="image" class="block text-sm font-medium text-gray-700 mb-2">Slot Image</label>
+                        <div class="flex items-center space-x-4">
+                            <?php if (!empty($slot['image'])): ?>
+                                <div class="flex-shrink-0">
+                                    <img src="/<?= htmlspecialchars($slot['image']) ?>" alt="Current image" class="h-20 w-20 rounded-lg object-cover border border-gray-300">
+                                </div>
+                            <?php endif; ?>
+                            <div class="flex-1">
+                                <input type="file" name="image_upload" id="image_upload" accept="image/*"
+                                       class="block w-full text-sm text-gray-500 file:mr-4 file:py-2 file:px-4 file:rounded-md file:border-0 file:text-sm file:font-medium file:bg-blue-50 file:text-blue-700 hover:file:bg-blue-100">
+                                <input type="hidden" name="current_image" value="<?= htmlspecialchars($slot['image'] ?? '') ?>">
+                                <p class="mt-1 text-xs text-gray-500">Upload an image file for the slot</p>
+                            </div>
+                        </div>
+                    </div>
+
+                    <!-- Demo URL -->
+                    <div>
+                        <label for="demo_url" class="block text-sm font-medium text-gray-700 mb-2">Demo URL</label>
+                        <input type="url" name="demo_url" id="demo_url"
+                               value="<?= htmlspecialchars($slot['demo_url'] ?? '') ?>" 
+                               class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500"
+                               placeholder="https://example.com/slot-demo">
+                        <p class="mt-1 text-xs text-gray-500">URL to play the demo version of the slot</p>
+                    </div>
+                </div>
+            </div>
+
+            <!-- Form Actions -->
+            <div class="flex justify-between pt-6 border-t border-gray-200">
+                <a href="/admin/slots/" class="inline-flex items-center px-4 py-2 border border-gray-300 shadow-sm text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 transition-colors">
+                    <svg class="w-5 h-5 mr-2" fill="currentColor" viewBox="0 0 20 20">
+                        <path fill-rule="evenodd" d="M7.707 14.707a1 1 0 01-1.414 0L2.586 11H9a1 1 0 010 2H2.586l3.707 3.707a1 1 0 01-1.414 1.414l-5.414-5.414a1 1 0 010-1.414L4.879 6.879a1 1 0 011.414 1.414L2.586 11H9a1 1 0 010 2H2.586l3.707 3.707z" clip-rule="evenodd"/>
+                    </svg>
+                    Back to List
+                </a>
+
+                <button type="submit" class="inline-flex items-center px-6 py-2 border border-transparent text-sm font-medium rounded-md text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 transition-colors">
+                    <svg class="w-5 h-5 mr-2" fill="currentColor" viewBox="0 0 20 20">
+                        <path fill-rule="evenodd" d="M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z" clip-rule="evenodd"/>
+                    </svg>
+                    <?= $action === 'create' ? 'Create Slot' : 'Update Slot' ?>
+                </button>
+            </div>
+        </form>
+    </div>
+</div>
+
+<?php
+$content = ob_get_clean();
+include __DIR__ . '/../partials/layout.php';
+?>

+ 163 - 0
resources/view/admin/slots/list.php

@@ -0,0 +1,163 @@
+<?php
+ob_start();
+?>
+
+<div class="min-h-screen bg-gray-50 py-6">
+    <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
+        <!-- Header -->
+        <div class="md:flex md:items-center md:justify-between mb-8">
+            <div class="flex-1 min-w-0">
+                <h2 class="text-2xl font-bold leading-7 text-gray-900 sm:text-3xl sm:truncate">
+                    Slot Management
+                </h2>
+                <p class="mt-1 text-sm text-gray-500">
+                    Manage casino slots and games
+                </p>
+            </div>
+            <div class="mt-4 flex md:mt-0 md:ml-4">
+                <a href="/admin/slots/?action=create" 
+                   class="ml-3 inline-flex items-center px-4 py-2 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 transition-colors">
+                    <svg class="w-5 h-5 mr-2" fill="currentColor" viewBox="0 0 20 20">
+                        <path fill-rule="evenodd" d="M10 3a1 1 0 011 1v5h5a1 1 0 110 2h-5v5a1 1 0 11-2 0v-5H4a1 1 0 110-2h5V4a1 1 0 011-1z" clip-rule="evenodd"/>
+                    </svg>
+                    Add New Slot
+                </a>
+            </div>
+        </div>
+
+        <!-- Success/Error Messages -->
+        <?php if (isset($success)): ?>
+            <div class="mb-6 bg-green-50 border border-green-200 rounded-md p-4">
+                <div class="flex">
+                    <div class="flex-shrink-0">
+                        <svg class="h-5 w-5 text-green-400" viewBox="0 0 20 20" fill="currentColor">
+                            <path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd"/>
+                        </svg>
+                    </div>
+                    <div class="ml-3">
+                        <p class="text-sm font-medium text-green-800"><?= htmlspecialchars($success) ?></p>
+                    </div>
+                </div>
+            </div>
+        <?php endif; ?>
+
+        <?php if (isset($error)): ?>
+            <div class="mb-6 bg-red-50 border border-red-200 rounded-md p-4">
+                <div class="flex">
+                    <div class="flex-shrink-0">
+                        <svg class="h-5 w-5 text-red-400" viewBox="0 0 20 20" fill="currentColor">
+                            <path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z" clip-rule="evenodd"/>
+                        </svg>
+                    </div>
+                    <div class="ml-3">
+                        <p class="text-sm font-medium text-red-800"><?= htmlspecialchars($error) ?></p>
+                    </div>
+                </div>
+            </div>
+        <?php endif; ?>
+
+        <!-- Slots Table -->
+        <div class="bg-white shadow overflow-hidden sm:rounded-md">
+            <div class="px-4 py-5 sm:px-6 border-b border-gray-200">
+                <h3 class="text-lg leading-6 font-medium text-gray-900">All Slots</h3>
+                <p class="mt-1 max-w-2xl text-sm text-gray-500">A list of all slots in the system.</p>
+            </div>
+            
+            <?php if (empty($slots)): ?>
+                <div class="text-center py-12">
+                    <svg class="mx-auto h-12 w-12 text-gray-400" stroke="currentColor" fill="none" viewBox="0 0 48 48">
+                        <path d="M34 40h10v-4a6 6 0 00-10.712-3.714M34 40H14m20 0v-4a9.971 9.971 0 00-.712-3.714M14 40H4v-4a6 6 0 0110.713-3.714M14 40v-4c0-1.313.253-2.566.713-3.714m0 0A9.971 9.971 0 0124 24c4.004 0 7.625 2.349 9.287 6m-9.287-6C16.348 24 12.723 26.349 11.061 30M4 16l4-4m0 0l4-4m-4 4L4 4m4 4v12"/>
+                    </svg>
+                    <h3 class="mt-2 text-sm font-medium text-gray-900">No slots</h3>
+                    <p class="mt-1 text-sm text-gray-500">Get started by creating a new slot.</p>
+                    <div class="mt-6">
+                        <a href="/admin/slots/?action=create" class="inline-flex items-center px-4 py-2 border border-transparent shadow-sm text-sm font-medium rounded-md text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500">
+                            <svg class="w-5 h-5 mr-2" fill="currentColor" viewBox="0 0 20 20">
+                                <path fill-rule="evenodd" d="M10 3a1 1 0 011 1v5h5a1 1 0 110 2h-5v5a1 1 0 11-2 0v-5H4a1 1 0 110-2h5V4a1 1 0 011-1z" clip-rule="evenodd"/>
+                            </svg>
+                            Add Slot
+                        </a>
+                    </div>
+                </div>
+            <?php else: ?>
+                <div class="overflow-x-auto">
+                    <table class="min-w-full divide-y divide-gray-200">
+                        <thead class="bg-gray-50">
+                            <tr>
+                                <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
+                                    Slot
+                                </th>
+                                <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
+                                    Provider
+                                </th>
+                                <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
+                                    RTP
+                                </th>
+                                <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
+                                    Created
+                                </th>
+                                <th scope="col" class="relative px-6 py-3">
+                                    <span class="sr-only">Actions</span>
+                                </th>
+                            </tr>
+                        </thead>
+                        <tbody class="bg-white divide-y divide-gray-200">
+                            <?php foreach ($slots as $slot): ?>
+                                <tr class="hover:bg-gray-50">
+                                    <td class="px-6 py-4 whitespace-nowrap">
+                                        <div class="flex items-center">
+                                            <?php if (!empty($slot['image'])): ?>
+                                                <div class="flex-shrink-0 h-10 w-10">
+                                                    <img class="h-10 w-10 rounded-lg object-cover" src="/<?= htmlspecialchars($slot['image']) ?>" alt="<?= htmlspecialchars($slot['name']) ?>">
+                                                </div>
+                                            <?php else: ?>
+                                                <div class="flex-shrink-0 h-10 w-10 bg-gray-300 rounded-lg flex items-center justify-center">
+                                                    <svg class="h-6 w-6 text-gray-500" fill="none" stroke="currentColor" viewBox="0 0 24 24">
+                                                        <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"/>
+                                                    </svg>
+                                                </div>
+                                            <?php endif; ?>
+                                            <div class="ml-4">
+                                                <div class="text-sm font-medium text-gray-900"><?= htmlspecialchars($slot['name']) ?></div>
+                                                <?php if (!empty($slot['demo_url'])): ?>
+                                                    <div class="text-sm text-gray-500">
+                                                        <a href="<?= htmlspecialchars($slot['demo_url']) ?>" target="_blank" class="text-blue-600 hover:text-blue-800">Demo available</a>
+                                                    </div>
+                                                <?php endif; ?>
+                                            </div>
+                                        </div>
+                                    </td>
+                                    <td class="px-6 py-4 whitespace-nowrap">
+                                        <div class="text-sm text-gray-900"><?= htmlspecialchars($slot['provider'] ?? 'N/A') ?></div>
+                                    </td>
+                                    <td class="px-6 py-4 whitespace-nowrap">
+                                        <div class="text-sm text-gray-900"><?= $slot['rtp'] ? number_format($slot['rtp'], 2) . '%' : 'N/A' ?></div>
+                                    </td>
+                                    <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
+                                        <?= date('M j, Y', strtotime($slot['created_at'])) ?>
+                                    </td>
+                                    <td class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium">
+                                        <div class="flex items-center justify-end space-x-2">
+                                            <a href="/admin/slots/?action=edit&id=<?= $slot['id'] ?>" 
+                                               class="text-blue-600 hover:text-blue-900 font-medium">Edit</a>
+                                            <form method="POST" class="inline" onsubmit="return confirm('Are you sure you want to delete this slot?');">
+                                                <input type="hidden" name="action" value="delete">
+                                                <input type="hidden" name="id" value="<?= $slot['id'] ?>">
+                                                <button type="submit" class="text-red-600 hover:text-red-900 font-medium ml-2">Delete</button>
+                                            </form>
+                                        </div>
+                                    </td>
+                                </tr>
+                            <?php endforeach; ?>
+                        </tbody>
+                    </table>
+                </div>
+            <?php endif; ?>
+        </div>
+    </div>
+</div>
+
+<?php
+$content = ob_get_clean();
+include __DIR__ . '/../partials/layout.php';
+?>

+ 150 - 0
src/Models/Faq.php

@@ -0,0 +1,150 @@
+<?php
+
+namespace App\Models;
+
+use App\Database;
+
+class Faq
+{
+    private $db;
+    
+    public function __construct()
+    {
+        $this->db = Database::getInstance();
+    }
+    
+    public function getAll()
+    {
+        return $this->db->fetchAll("SELECT * FROM faqs ORDER BY created_at DESC");
+    }
+    
+    public function getById($id)
+    {
+        $result = $this->db->fetchOne("SELECT * FROM faqs WHERE id = ?", [$id]);
+        
+        // Decode extra_fields JSON
+        if ($result && !empty($result['extra_fields'])) {
+            $result['extra_fields'] = json_decode($result['extra_fields'], true) ?: [];
+        } else if ($result) {
+            $result['extra_fields'] = [];
+        }
+        
+        return $result;
+    }
+    
+    public function getByMorphable($faqableType, $faqableId)
+    {
+        $result = $this->db->fetchAll(
+            "SELECT * FROM faqs WHERE faqable_type = ? AND faqable_id = ? ORDER BY created_at ASC", 
+            [strtolower($faqableType), $faqableId]
+        );
+        
+        // Decode extra_fields JSON for each record
+        foreach ($result as &$item) {
+            if (!empty($item['extra_fields'])) {
+                $item['extra_fields'] = json_decode($item['extra_fields'], true) ?: [];
+            } else {
+                $item['extra_fields'] = [];
+            }
+        }
+        
+        return $result;
+    }
+    
+    public function create($data)
+    {
+        $sql = "INSERT INTO faqs (faqable_type, faqable_id, title, extra_fields) VALUES (?, ?, ?, ?)";
+        $params = [
+            strtolower($data['faqable_type']),
+            $data['faqable_id'],
+            $data['title'] ?? null,
+            $data['extra_fields'] ? json_encode($data['extra_fields']) : null
+        ];
+        
+        $this->db->execute($sql, $params);
+        return $this->db->lastInsertId();
+    }
+    
+    public function update($id, $data)
+    {
+        $sql = "UPDATE faqs SET faqable_type = ?, faqable_id = ?, title = ?, extra_fields = ?, updated_at = CURRENT_TIMESTAMP WHERE id = ?";
+        $params = [
+            strtolower($data['faqable_type']),
+            $data['faqable_id'],
+            $data['title'] ?? null,
+            $data['extra_fields'] ? json_encode($data['extra_fields']) : null,
+            $id
+        ];
+        
+        return $this->db->execute($sql, $params);
+    }
+    
+    public function updateOrCreate($faqableType, $faqableId, $data)
+    {
+        $faqableType = strtolower($faqableType);
+        $existing = $this->getByMorphable($faqableType, $faqableId);
+        
+        $data['faqable_type'] = $faqableType;
+        $data['faqable_id'] = $faqableId;
+        
+        if (!empty($existing)) {
+            return $this->update($existing[0]['id'], $data);
+        } else {
+            return $this->create($data);
+        }
+    }
+    
+    public function delete($id)
+    {
+        return $this->db->execute("DELETE FROM faqs WHERE id = ?", [$id]);
+    }
+    
+    public function deleteByMorphable($faqableType, $faqableId)
+    {
+        return $this->db->execute(
+            "DELETE FROM faqs WHERE faqable_type = ? AND faqable_id = ?", 
+            [strtolower($faqableType), $faqableId]
+        );
+    }
+    
+    public function exists($faqableType, $faqableId)
+    {
+        $result = $this->db->fetchOne(
+            "SELECT COUNT(*) as count FROM faqs WHERE faqable_type = ? AND faqable_id = ?", 
+            [strtolower($faqableType), $faqableId]
+        );
+        return $result['count'] > 0;
+    }
+    
+    // Helper methods for any entity type
+    public function getForRecord($entityType, $entityId)
+    {
+        return $this->getByMorphable($entityType, $entityId);
+    }
+    
+    public function createForRecord($entityType, $entityId, $data)
+    {
+        return $this->updateOrCreate($entityType, $entityId, $data);
+    }
+    
+    public function deleteForRecord($entityType, $entityId)
+    {
+        return $this->deleteByMorphable($entityType, $entityId);
+    }
+    
+    // Convenience methods for specific entity types
+    public function getForPage($pageId)
+    {
+        return $this->getForRecord('page', $pageId);
+    }
+    
+    public function createForPage($pageId, $data)
+    {
+        return $this->createForRecord('page', $pageId, $data);
+    }
+    
+    public function deleteForPage($pageId)
+    {
+        return $this->deleteForRecord('page', $pageId);
+    }
+}

+ 95 - 0
src/Models/Slot.php

@@ -0,0 +1,95 @@
+<?php
+
+namespace App\Models;
+
+use App\Database;
+
+class Slot
+{
+    private $db;
+    
+    public function __construct()
+    {
+        $this->db = Database::getInstance();
+    }
+    
+    public function getAll()
+    {
+        return $this->db->fetchAll("SELECT * FROM slots ORDER BY created_at DESC");
+    }
+    
+    public function getById($id)
+    {
+        return $this->db->fetchOne("SELECT * FROM slots WHERE id = ?", [$id]);
+    }
+    
+    public function getByProvider($provider)
+    {
+        return $this->db->fetchAll("SELECT * FROM slots WHERE provider = ? ORDER BY name ASC", [$provider]);
+    }
+    
+    public function create($data)
+    {
+        $sql = "INSERT INTO slots (name, image, provider, rtp, demo_url) VALUES (?, ?, ?, ?, ?)";
+        $params = [
+            $data['name'],
+            $data['image'] ?? null,
+            $data['provider'] ?? null,
+            $data['rtp'] ?? null,
+            $data['demo_url'] ?? null
+        ];
+        
+        $this->db->execute($sql, $params);
+        return $this->db->lastInsertId();
+    }
+    
+    public function update($id, $data)
+    {
+        $sql = "UPDATE slots SET name = ?, image = ?, provider = ?, rtp = ?, demo_url = ?, updated_at = CURRENT_TIMESTAMP WHERE id = ?";
+        $params = [
+            $data['name'],
+            $data['image'] ?? null,
+            $data['provider'] ?? null,
+            $data['rtp'] ?? null,
+            $data['demo_url'] ?? null,
+            $id
+        ];
+        
+        return $this->db->execute($sql, $params);
+    }
+    
+    public function delete($id)
+    {
+        return $this->db->execute("DELETE FROM slots WHERE id = ?", [$id]);
+    }
+    
+    public function exists($name, $excludeId = null)
+    {
+        if ($excludeId) {
+            return $this->db->fetchOne("SELECT id FROM slots WHERE name = ? AND id != ?", [$name, $excludeId]);
+        }
+        
+        return $this->db->fetchOne("SELECT id FROM slots WHERE name = ?", [$name]);
+    }
+    
+    public function getProviders()
+    {
+        $result = $this->db->fetchAll("SELECT DISTINCT provider FROM slots WHERE provider IS NOT NULL ORDER BY provider ASC");
+        return array_column($result, 'provider');
+    }
+    
+    public function search($query, $provider = null)
+    {
+        $sql = "SELECT * FROM slots WHERE name LIKE ?";
+        $params = ["%{$query}%"];
+        
+        if ($provider) {
+            $sql .= " AND provider = ?";
+            $params[] = $provider;
+        }
+        
+        $sql .= " ORDER BY name ASC";
+        
+        return $this->db->fetchAll($sql, $params);
+    }
+}

+ 16 - 0
src/Pages/admin/pages.php

@@ -2,10 +2,12 @@
 
 use App\Models\Page;
 use App\Models\SeoMeta;
+use App\Models\Faq;
 use App\Enums\PageLayout;
 
 $pageModel = new Page();
 $seoMetaModel = new SeoMeta();
+$faqModel = new Faq();
 $action = $_GET['action'] ?? 'list';
 $id = $_GET['id'] ?? null;
 
@@ -39,6 +41,15 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
                 if (!empty($data['seo'])) {
                     $seoMetaModel->updateOrCreate('Page', $pageId, $data['seo']);
                 }
+                
+                // Save FAQ data if provided
+                if (!empty($data['faq'])) {
+                    $faqData = [
+                        'title' => $data['faq']['title'] ?? '',
+                        'extra_fields' => $data['faq']['items'] ?? []
+                    ];
+                    $faqModel->updateOrCreate('page', $pageId, $faqData);
+                }
                 header("Location: /admin/pages/?action=edit&id=" . $pageId);exit;
 
                 break;
@@ -89,6 +100,10 @@ switch ($action) {
         
         // Load SEO data
         $seoMeta = $seoMetaModel->getForRecord('page', $id) ?: [];
+        
+        // Load FAQ data
+        $faqData = $faqModel->getForRecord('page', $id);
+        $faqs = !empty($faqData) && is_array($faqData) ? $faqData[0] : [];
         break;
         
     case 'list':
@@ -113,6 +128,7 @@ return ViewRender($template, [
     'pages' => $pages ?? [],
     'page' => $page ?? null,
     'seoMeta' => $seoMeta ?? [],
+    'faqs' => $faqs ?? [],
     'layouts' => $layouts,
     'success' => $success ?? null,
     'error' => $error ?? null

+ 104 - 0
src/Pages/admin/slots.php

@@ -0,0 +1,104 @@
+<?php
+
+use App\Models\Slot;
+
+$slotModel = new Slot();
+$action = $_GET['action'] ?? 'list';
+$id = $_GET['id'] ?? null;
+
+// Handle form submissions
+if ($_SERVER['REQUEST_METHOD'] === 'POST') {
+    $data = $_POST;
+    
+    // Handle image upload
+    if (!empty($_FILES['image_upload']['name'])) {
+        $uploadedImage = uploadImage($_FILES['image_upload']);
+        if ($uploadedImage) {
+            $data['image'] = $uploadedImage;
+        }
+    } else {
+        // Keep current image if no new upload
+        $data['image'] = $data['current_image'] ?? '';
+    }
+    
+    // Get action from form data
+    $formAction = $data['action'] ?? $action;
+    
+    try {
+        switch ($formAction) {
+            case 'create':
+            case 'edit':
+                if ($formAction === 'create') {
+                    $slotId = $slotModel->create($data);
+                    $success = "Slot created successfully!";
+                } else {
+                    $slotModel->update($id, $data);
+                    $slotId = $id;
+                    $success = "Slot updated successfully!";
+                }
+                header("Location: /admin/slots/?action=edit&id=" . $slotId);
+                exit;
+                break;
+                
+            case 'delete':
+                if ($id) {
+                    $slotModel->delete($id);
+                    $success = "Slot deleted successfully!";
+                    $action = 'list';
+                }
+                break;
+        }
+    } catch (Exception $e) {
+        $error = "Error: " . $e->getMessage();
+    }
+}
+
+// Get data for different actions
+switch ($action) {
+    case 'create':
+    case 'new':
+        $slot = [
+            'name' => '',
+            'image' => '',
+            'provider' => '',
+            'rtp' => '',
+            'demo_url' => ''
+        ];
+        $action = 'create';
+        break;
+        
+    case 'edit':
+        if (!$id) {
+            $action = 'list';
+            break;
+        }
+        
+        $slot = $slotModel->getById($id);
+        if (!$slot) {
+            $error = "Slot not found!";
+            $action = 'list';
+            break;
+        }
+        break;
+        
+    case 'list':
+    default:
+        $slots = $slotModel->getAll();
+        $action = 'list';
+        break;
+}
+
+// Determine which template to use
+$template = match($action) {
+    'list' => 'admin/slots/list.php',
+    'create', 'edit' => 'admin/slots/form.php',
+    default => 'admin/slots/list.php'
+};
+
+return ViewRender($template, [
+    'action' => $action,
+    'slots' => $slots ?? [],
+    'slot' => $slot ?? null,
+    'success' => $success ?? null,
+    'error' => $error ?? null
+]);

+ 8 - 0
src/Pages/home.php

@@ -3,10 +3,12 @@
 use App\Settings;
 use App\Models\Page;
 use App\Models\SeoMeta;
+use App\Models\Faq;
 
 // Получение главной страницы
 $pageModel = new Page();
 $seoMetaModel = new SeoMeta();
+$faqModel = new Faq();
 
 // Находим главную страницу
 $homepage = \db()->fetchOne("SELECT * FROM pages WHERE is_homepage = 1");
@@ -30,6 +32,11 @@ $pageContent = $homepage['content'] ?? '';
 $extraFields = json_decode($homepage['extra_fields'] ?? '{}', true) ?: [];
 $topContent = $extraFields['top_content'] ?? '';
 
+// Загружаем FAQ для главной страницы
+$faqData = $faqModel->getForRecord('page', $homepage['id']);
+$faqs = !empty($faqData) && is_array($faqData) ? $faqData[0] : [];
+$faqItems = $faqs['extra_fields'] ?? [];
+
 // Parse JSON fields needed for view
 $bannerLogo = json_decode($content['banner-logo'] ?? '{}', true);
 $casinoItems = json_decode($content['casino_list'] ?? '[]', true);
@@ -72,6 +79,7 @@ return ViewRender('home.php', [
     'content' => $content,
     'seo' => $seo,
     'faqItems' => $faqItems,
+    'faqTitle' => $faqs['title'] ?? '',
     'pageContent' => $pageContent,
     'topContent' => $topContent,
     'currentDomain' => $currentDomain,

+ 1 - 1
src/helpers.php

@@ -245,7 +245,7 @@ function uploadImage($files, $fieldName = null): bool|string {
     
     if (move_uploaded_file($file['tmp_name'], $targetPath)) {
         // Возвращаем относительный путь для веб-доступа
-        return 'uploads/' . $fileName;
+        return 'media/' . $fileName;
     }
     
     return false;