### Install Botble CMS Source: https://docs.botble.com/cms/commands Installs the Botble CMS by running migrations, creating a super user, activating plugins, and publishing assets. This is an interactive command that guides the user through the setup process. ```bash php artisan cms:install ``` -------------------------------- ### Form Submission Routes Example (PHP) Source: https://docs.botble.com/cms/theme-development/theme-routes This PHP code example shows how to set up routes for handling form submissions. It defines separate routes for displaying the form (GET request) and for processing the submitted data (POST request), ensuring proper handling of user input. ```php Theme::registerRoutes(function (): void { Route::group(['controller' => YourThemeController::class], function (): void { Route::get('contact', 'getContact')->name('public.contact'); Route::post('contact', 'postContact')->name('public.contact.post'); }); }); ``` -------------------------------- ### Responsive Design CSS Example Source: https://docs.botble.com/cms/theme-development/theme-seo-optimization A basic CSS example demonstrating responsive design principles. It adjusts container width for smaller screens to ensure better mobile usability, contributing to SEO. ```css /* Use responsive design */ @media (max-width: 768px) { .container { width: 100%; padding: 0 15px; } } ``` -------------------------------- ### Seed Database with Sample Data using Sail Source: https://docs.botble.com/cms/installation-using-docker Populates the database with sample data using Botble CMS's seeder classes. This is useful for development and testing to quickly get a populated environment. ```shell sail artisan db:seed ``` -------------------------------- ### TextField Example Source: https://docs.botble.com/cms/form-builder-get-started This snippet shows the configuration for a standard text input field. It includes options for label, placeholder, required status, and maximum length. ```php use Botble\Base\Forms\Fields\TextField; use Botble\Base\Forms\FieldOptions\TextFieldOption; ->add('name', TextField::class, TextFieldOption::make() ->label('Name') ->placeholder('Enter name') ->required() ->maxLength(255) ) ``` -------------------------------- ### Rendering a Form from a Controller Source: https://docs.botble.com/cms/form-builder-get-started This example illustrates how to render a form within a controller method. It injects the form class and calls the renderForm method. ```php use Botble\Todo\Forms\TodoForm; public function create(TodoForm $form) { return $form->renderForm(); } ``` -------------------------------- ### Start Botble CMS Services with Docker Source: https://docs.botble.com/cms/installation-using-docker Starts the Docker services defined in the docker-compose.yml file in detached mode. This command is essential for running the Botble CMS application and its associated services (like database, cache) in the background. ```shell sail up -d ``` -------------------------------- ### PhoneNumberField Example Source: https://docs.botble.com/cms/form-builder-get-started This example configures a phone number input field, which may include formatting capabilities. Options for label are demonstrated. ```php use Botble\Base\Forms\Fields\PhoneNumberField; use Botble\Base\Forms\FieldOptions\PhoneNumberFieldOption; ->add('phone', PhoneNumberField::class, PhoneNumberFieldOption::make() ->label('Phone Number') ) ``` -------------------------------- ### Install Composer Dependencies with Docker Source: https://docs.botble.com/cms/installation-using-docker Installs Composer dependencies for the project within a Docker container. It mounts the current directory and Composer's home directory into the container. This command is typically used for initial setup or when updating dependencies. ```shell docker run --rm --interactive --tty \ --volume $PWD:/app \ --volume ${COMPOSER_HOME:-$HOME/.composer}:/tmp \ composer install --ignore-platform-reqs ``` -------------------------------- ### Form Layouts: 2 Columns Source: https://docs.botble.com/cms/form-builder-get-started This example shows how to arrange form fields into a two-column layout using the 'columns()' method and specifying the colspan for each field. ```php use Botble\Base\Forms\Fields\TextField; use Botble\Base\Forms\Fields\TextareaField; $this ->columns() // Use 2 columns layout ->add('field1', TextField::class, TextFieldOption::make()->colspan(6)) ->add('field2', TextField::class, TextFieldOption::make()->colspan(6)); ``` -------------------------------- ### NumberField Example Source: https://docs.botble.com/cms/form-builder-get-started This snippet shows the configuration for a numeric input field, suitable for integers and decimals. It includes options for label and setting minimum, maximum, and step values. ```php use Botble\Base\Forms\Fields\NumberField; ->add('quantity', NumberField::class, [ 'label' => 'Quantity', 'min' => 1, 'max' => 1000, 'step' => 1, ]) ``` -------------------------------- ### PHP Quick Reference for Botble CMS Features Source: https://docs.botble.com/cms/ai-assistant-guide A collection of PHP code examples for common Botble CMS functionalities. This includes accessing enum values and labels, performing translations, using Eloquent, defining form fields, and security sanitization. ```php // Enum value access $model->status->getValue() // Get value $model->status->label() // Get label (string) $model->status // Cast to string BaseStatusEnum::PUBLISHED // Constant value BaseStatusEnum::PUBLISHED() // Enum instance // Translations trans('plugins/name::file.key') // Admin __('theme.key') // Frontend // Eloquent Model::query()->where(...)->get() // Always use query() ->with(['relation']) // Eager load // Forms NameFieldOption::make()->required() // Field options StatusFieldOption::make() // Status select // Security BaseHelper::clean($html) // Sanitize HTML @json($data) // Safe JS embedding ``` -------------------------------- ### Create Botble CMS Backup (Bash) Source: https://docs.botble.com/cms/domain-migration Creates a full backup of the Botble CMS installation, including database and files, before performing a domain migration. This command is part of the Botble CMS CLI tools. ```bash php artisan cms:backup:create "pre-migration-backup" --description="Full backup before domain migration" ``` -------------------------------- ### Semantic HTML Example Source: https://docs.botble.com/cms/theme-development/theme-seo-optimization This HTML snippet showcases the use of semantic elements like `
`, `
`, `
`, and `