PHP code example of otas / dynamic-pages

1. Go to this page and download the library: Download otas/dynamic-pages library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

otas / dynamic-pages example snippets


// Global API prefix for all routes
'package_routes_prefix' => 'api',

// Specific prefixes for different route types
'package_admin_routes_prefix' => '',
'package_support_routes_prefix' => '',
'package_website_routes_prefix' => '',

// Enable/disable route loading
'load_routes' => true,

'middlewares' => [
    'admin' => [
        // Add your admin middleware here
        // Example: 'auth:admin', 'permission:manage-dynamic-pages'
    ],
    'support' => [
        // Add your support middleware here
        // Example: 'auth:support', 'permission:support-access'
    ],
    'website' => [
        // Add your public middleware here
        // Example: 'throttle:60,1', 'cors'
    ],
],

DynamicPagesSeeder::seedContent([
    [
        'page_path' => 'home',
        'translation_data' => [
            'en' => [
                'name' => 'Home',
                'title' => 'Page Title',
                'description' => 'Page Description',
            ],
            'ar' => [
                'name' => 'الرئيسية',
                'title' => 'عنوان الصفحة',
                'description' => 'تفاصيل الصفحة',
            ],
        ],
        'sections' => [
            [
                'identifier' => 'hero-section',
                'has_title' => true,
                'has_description' => true,
                'images_count' => 1,
                'has_items' => true,
                'item_images_count' => 1,
                'has_items_title' => true,
                'has_items_description' => true,
                'title_validation_text' => 'sometimes|string|min:3|max:190',
                'description_validation_text' => 'sometimes|string|min:3|max:1000',
                'translation_data' => [
                    'en' => ['name' => 'Hero Section'],
                    'ar' => ['name' => 'قسم البطل'],
                ],
                'items' => [
                    // Section items configuration
                ],
                'custom_attributes' => [
                    // Custom attributes configuration
                ],
            ],
        ],
    ],
]);
bash
php artisan dynamic-pages:setup
bash
php artisan vendor:publish --provider="Otas\DynamicPages\DynamicPagesServiceProvider"
bash
php artisan migrate
bash
php artisan config:cache
bash
php artisan vendor:publish --provider="Otas\DynamicPages\DynamicPagesServiceProvider"
bash
php artisan db:seed --class=DynamicPagesContentSeeder