PHP code example of nbaskoff / beetlecore
1. Go to this page and download the library: Download nbaskoff/beetlecore 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/ */
nbaskoff / beetlecore example snippets
namespace App\BeetleCMS;
use BeetleCore\Fields\HtmlField;
use BeetleCore\Fields\TextareaField;
use BeetleCore\Fields\TextboxField;
use BeetleCore\Fields\UrlField;
use BeetleCore\Validators\NoEmpty;
use BeetleCore\Validators\Unique;
class PageModel extends AdminModel
{
protected $table = "page";
public $modelName = "Страницы";
public $modelDescription = "";
public $positionKey = "position";
public $canAdd = false;
public $canDelete = false;
protected $fields = [
"name" => [
"name" => "Название",
"type" => TextboxField::class,
"validators" => [
[NoEmpty::class],
[Unique::class]
],
],
"link" => [
"name" => "Адрес страницы (url)",
"type" => UrlField::class,
"mask" => "/page/{url}",
"validators" => [
[NoEmpty::class],
[Unique::class]
],
],
"title" => [
"name" => "title",
"type" => TextboxField::class,
"show" => false,
"find" => false,
"tab" => "SEO"
],
"description" => [
"name" => "description",
"type" => TextareaField::class,
"show" => false,
"find" => false,
"tab" => "SEO"
],
"keywords" => [
"name" => "keywords",
"type" => TextareaField::class,
"show" => false,
"find" => false,
"tab" => "SEO"
],
"body" => [
"name" => "Текст",
"type" => HtmlField::class,
"show" => false
],
];
protected $settings = [];
protected $links = [
//"colors.pages" => ["admin.color", "Цвета"],
];
}