Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- return [
- 'login' => [
- 'rules' => [
- 'default' => [
- 'login' => [['string', 'minlen'=>5, 'maxlen'=>64]],
- 'password' => [['string', 'minlen'=>5, 'maxlen'=>64]],
- ],
- ],
- ],
- 'search' => [
- 'rules' => [
- 'default' => [
- 'q' =>['string'],
- ],
- ],
- ],
- 'contact' => [
- 'rules' => [
- 'default' => [
- 'name' =>[['string', 'maxlen'=>64], ['default', 'value'=>'Имя НЕ указано']],
- 'email' =>['email','required'],
- 'phone' =>[['string', 'maxlen'=>64], ['default', 'value'=>'Телефон НЕ указан']],
- 'subject' =>[['string', 'maxlen'=>64],'required'],
- 'message' =>[['string', 'minlen'=>10],'required','text'],
- ],
- ],
- ],
- // TRASH...
- 'trash' => [
- 'class' => 'page',
- 'rules' => [
- 'default' => [
- 'id' => ['int'],
- 'sort' => ['int'],
- 'type' => ['string'],
- 'subtype' => ['string'],
- 'created' => ['int','timeCreate'],
- 'updated' => ['int','timeUpdate'],
- 'trash' => ['boolean'],
- 'slug' => [['slug','field'=>'title'],['string', 'maxlen'=>120],['unique','fields'=>['parent_id']]],
- 'title' => [['string', 'maxlen'=>120],'required',['unique','fields'=>['parent_id']]],
- ],
- ],
- 'box' => [
- 'table' => 'page',
- 'where' =>[['trash'=>1]],
- 'order' => 'sort',
- ],
- ],
- // Страницы
- 'article' => [
- 'class' => 'page',
- 'rules' => [
- 'search' => [
- 'title' => [['string', 'maxlen'=>120]],
- 'article' => [['string', 'maxlen'=>60000]],
- ],
- 'default' => [
- 'id' => ['int'],
- 'sort' => ['int'],
- 'parent_id' => [
- 'int',
- ['select', 'box'=>'page', 'valueField'=>'id', 'descField'=>'breadtitle'],
- ['defaultSave','value'=>1], // index
- ],
- 'type' => ['string',['defaultSave','value'=>'article']],
- 'subtype' => ['string','unique','required'],
- 'created' => ['int','timeCreate'],
- 'updated' => ['int','timeUpdate'],
- 'trash' => ['boolean'],
- 'folder' => ['hidden'],
- 'slug' => [['copy','field'=>'subtype'],'unique'],
- 'title' => [['string', 'maxlen'=>120],'required',['unique','fields'=>['parent_id']]],
- 'metatitle' => [['string', 'maxlen'=>120],['defaultCopy','field'=>'title']],
- 'breadtitle' => [['string', 'maxlen'=>60],['defaultCopyStrict','field'=>'title', 'maxlen'=>60]],
- 'menutitle' => [['string', 'maxlen'=>60],['defaultCopyStrict','field'=>'title', 'maxlen'=>60]],
- 'article' => [['article', 'maxlen'=>60000]],
- 'preview' => [['text', 'maxlen'=>250],['defaultCopyStrict','field'=>'article', 'maxlen'=>250]],
- 'metadesc' => [['text', 'maxlen'=>250],['defaultCopyStrict','field'=>'article', 'maxlen'=>250]],
- ],
- ],
- 'relations' => [
- 'parent'=> [
- 'boxName'=> 'page',
- 'type'=>'one',
- 'modelField' => 'parent_id',
- 'boxField' => 'id',
- ],
- 'childs'=> [
- 'boxName'=> 'page',
- 'type'=>'many',
- 'modelField' => 'id',
- 'boxField' => 'parent_id',
- ],
- ],
- 'box' => [
- 'table' => 'page',
- 'where' =>[['type'=>'article','trash'=>0]],
- 'order' => 'sort',
- ],
- ],
- // Производители
- 'manuf' => [
- 'class' => 'page',
- 'rules' => [
- 'search' => [
- 'title' => [['string', 'maxlen'=>120]],
- 'article' => [['string', 'maxlen'=>60000]],
- ],
- 'default' => [
- 'id' => ['int'],
- 'sort' => ['int'],
- 'parent_id' => ['int',['defaultSave','value'=>49]], // manufList
- 'type' => ['string',['defaultSave','value'=>'manuf']],
- 'created' => ['int','timeCreate'],
- 'updated' => ['int','timeUpdate'],
- 'trash' => ['boolean'],
- 'folder' => ['hidden'],
- 'thumb' => [['string', 'maxlen'=>120],'img'],
- 'slug' => [['slug','field'=>'title'],['string', 'maxlen'=>120],['unique','fields'=>['parent_id']]],
- 'title' => [['string', 'maxlen'=>120],'required',['unique','fields'=>['parent_id']]],
- 'metatitle' => [['string', 'maxlen'=>120],['defaultCopy','field'=>'title']],
- 'breadtitle' => [['string', 'maxlen'=>60],['defaultCopyStrict','field'=>'title', 'maxlen'=>60]],
- 'menutitle' => [['string', 'maxlen'=>60],['defaultCopyStrict','field'=>'title', 'maxlen'=>60]],
- 'article' => [['article', 'maxlen'=>60000]],
- 'preview' => [['text', 'maxlen'=>250],['defaultCopyStrict','field'=>'article', 'maxlen'=>250]],
- 'metadesc' => [['text', 'maxlen'=>250],['defaultCopyStrict','field'=>'article', 'maxlen'=>250]],
- ],
- ],
- 'relations' => [
- 'parent'=> [
- 'boxName'=> 'page',
- 'type'=>'one',
- 'modelField' => 'parent_id',
- 'boxField' => 'id',
- ],
- 'products'=> [
- 'boxName'=> 'product',
- 'type'=>'many',
- 'modelField' => 'id',
- 'boxField' => 'manuf_id',
- ],
- ],
- 'box' => [
- 'table' => 'page',
- 'where' =>[['type'=>'manuf','trash'=>0]],
- 'order' => 'sort',
- ],
- ],
- // Товары
- 'product' => [
- 'class' => 'page',
- 'rules' => [
- 'search' => [
- 'title' => [['string', 'maxlen'=>120]],
- 'article' => [['string', 'maxlen'=>60000]],
- 'manuf_id' =>['int',['select', 'box'=>'manuf', 'valueField'=>'id', 'descField'=>'breadtitle']],
- 'category_id' => ['int',['select', 'box'=>'category', 'valueField'=>'id', 'descField'=>'breadtitle']],
- ],
- 'default' => [
- 'id' => ['int'],
- 'sort' => ['int'],
- 'parent_id' => ['int',['copy','field'=>'category_id']],
- 'type' => ['string',['defaultSave','value'=>'product']],
- 'created' => ['int','timeCreate'],
- 'updated' => ['int','timeUpdate'],
- 'trash' => ['boolean'],
- 'topsale' => ['boolean'],
- 'action' => ['boolean'],
- 'newproduct' => ['boolean'],
- 'manuf_id' =>['int','required',['select', 'box'=>'manuf', 'valueField'=>'id', 'descField'=>'breadtitle']],
- 'category_id' => ['int','required',['select', 'box'=>'category', 'valueField'=>'id', 'descField'=>'breadtitle']],
- 'price' =>['int'],
- 'folder' => ['hidden'],
- 'thumb' => [['string', 'maxlen'=>120],'img'],
- 'slug' => [
- ['slug','field'=>'title'],
- ['string', 'maxlen'=>120],
- ['unique']
- ],
- 'title' => [['string', 'maxlen'=>120],'required',['unique','fields'=>['parent_id']]],
- 'metatitle' => [['string', 'maxlen'=>120],['defaultCopy','field'=>'title']],
- 'breadtitle' => [['string', 'maxlen'=>60],['defaultCopyStrict','field'=>'title', 'maxlen'=>60]],
- 'menutitle' => [['string', 'maxlen'=>60],['defaultCopyStrict','field'=>'title', 'maxlen'=>60]],
- 'article' => [['article', 'maxlen'=>60000]],
- 'preview' => [['text', 'maxlen'=>250],['defaultCopyStrict','field'=>'article', 'maxlen'=>250]],
- 'metadesc' => [['text', 'maxlen'=>250],['defaultCopyStrict','field'=>'article', 'maxlen'=>250]],
- 'img1' => [['string', 'maxlen'=>120],'img'],
- 'img2' => [['string', 'maxlen'=>120],'img'],
- 'img3' => [['string', 'maxlen'=>120],'img'],
- 'img4' => [['string', 'maxlen'=>120],'img'],
- 'img5' => [['string', 'maxlen'=>120],'img'],
- ],
- ],
- 'relations' => [
- 'manuf'=> [
- 'boxName'=> 'manuf',
- 'type'=>'one',
- 'modelField' => 'manuf_id',
- 'boxField' => 'id',
- ],
- 'category'=> [
- 'boxName'=> 'category',
- 'type'=>'one',
- 'modelField' => 'category_id',
- 'boxField' => 'id',
- ],
- 'parent'=> [
- 'boxName'=> 'page',
- 'type'=>'one',
- 'modelField' => 'parent_id',
- 'boxField' => 'id',
- ],
- ],
- 'box' => [
- 'table' => 'page',
- 'where' =>[['type'=>'product','trash'=>0]],
- 'limit' => 21,
- 'order' => 'sort',
- ],
- ],
- // Категории
- 'category' => [
- 'class' => 'page',
- 'rules' => [
- 'search' => [
- 'title' => [['string', 'maxlen'=>120]],
- 'article' => [['string', 'maxlen'=>60000]],
- ],
- 'default' => [
- 'id' => ['int'],
- 'sort' => ['int'],
- 'parent_id' => ['int',['defaultSave','value'=>50]], // categoryList
- 'type' => ['string',['defaultSave','value'=>'category']],
- 'created' => ['int','timeCreate'],
- 'updated' => ['int','timeUpdate'],
- 'trash' => ['boolean'],
- 'needmenu' => ['boolean'],
- 'list1' => ['boolean'],
- 'folder' => ['hidden'],
- 'thumb' => [['string', 'maxlen'=>120],'img'],
- 'slug' => [['slug','field'=>'title'],['string', 'maxlen'=>120],['unique','fields'=>['parent_id']]],
- 'title' => [['string', 'maxlen'=>120],'required',['unique','fields'=>['parent_id']]],
- 'metatitle' => [['string', 'maxlen'=>120],['defaultCopy','field'=>'title']],
- 'breadtitle' => [['string', 'maxlen'=>60],['defaultCopyStrict','field'=>'title', 'maxlen'=>60]],
- 'menutitle' => [['string', 'maxlen'=>60],['defaultCopyStrict','field'=>'title', 'maxlen'=>60]],
- 'article' => [['article', 'maxlen'=>60000]],
- 'preview' => [['text', 'maxlen'=>250],['defaultCopyStrict','field'=>'article', 'maxlen'=>250]],
- 'metadesc' => [['text', 'maxlen'=>250],['defaultCopyStrict','field'=>'article', 'maxlen'=>250]],
- ],
- ],
- 'relations' => [
- 'parent'=> [
- 'boxName'=> 'page',
- 'type'=>'one',
- 'modelField' => 'parent_id',
- 'boxField' => 'id',
- ],
- 'products'=> [
- 'boxName'=> 'product',
- 'type'=>'many',
- 'modelField' => 'id',
- 'boxField' => 'category_id',
- ],
- ],
- 'box' => [
- 'table' => 'page',
- 'where' =>[['type'=>'category','trash'=>0]],
- 'order' => 'sort',
- ],
- ],
- ];
Advertisement
Add Comment
Please, Sign In to add comment