<?php Admin::model('App\\Teachers')->title('Наставники')->display(function () { $display = AdminDisplay::table(); $display->columns([Column::string('name')->label('ФИО'), Column::datetime('created_at')->label('Дата создания'), Column::datetime('updated_at')->label('Дата изменения')]); return $display; })->createAndEdit(function () { $form = AdminForm::form(); $form->items([FormItem::columns()->columns([[FormItem::text('name', 'Название'), FormItem::textarea('desc', 'Описание'), FormItem::ckeditor('desc_detail', 'Подробное описание')], [FormItem::images('images', 'Фотографии')]])]); return $form; });
<?php /** * Created by PhpStorm. * User: nursultan * Date: 3-Jul 15 * Time: 22:50 */ Admin::model(\App\Field::class)->title('Fields')->with('infrastructures', 'city', 'category', 'cover')->columns(function () { Column::string('name', 'Name'); Column::string('opens', 'Opens'); Column::string('closes', 'Closes'); Column::string('roof', 'Roof'); Column::string('price', 'Price'); Column::string('phoneNumber', 'PhoneNumber'); Column::string('address', 'Address'); Column::string('description', 'Description'); Column::string('longitude', 'Longitude'); Column::string('latitude', 'Latitude'); })->form(function () { FormItem::text('name'); FormItem::time('opens'); FormItem::time('closes'); FormItem::checkbox('roof', 'Roof'); FormItem::textAddon('price')->addon('Сом')->placement('after'); FormItem::text('phoneNumber'); FormItem::text('address'); FormItem::textarea('description'); FormItem::text('longitude'); FormItem::text('latitude'); });
<?php /** * @var \SleepingOwl\Admin\Model\ModelConfiguration */ $model = Admin::model(\App\Slide::class); $model->title('Слайды'); $model->display(function () { $display = AdminDisplay::datatables(); $display->with('page'); $display->columns([Column::image('image')->label('Картинка')->orderable(false), Column::string('title')->label('Заголовок')->orderable(false), Column::string('description')->label('Описание')->orderable(false), Column::string('page.title')->label('Страница')->append(Column::filter('id')->model(\App\Page::class)->field('page_id'))->orderable(false), Column::order()->orderable(false)]); $display->apply(function ($query) { $query->orderBy('sort', 'asc'); }); return $display; }); $model->createAndEdit(function ($id) use($model) { $model->title($id ? 'Редактировать слайд' : 'Создать слайд'); $form = AdminForm::form(); $form->items([FormItem::columns()->columns([[FormItem::text('title', 'Заголовок')->required(), FormItem::select('page_id', 'Страница')->model(\App\Page::class)->display('title')->required(), FormItem::textarea('description', 'Описание')->rows(4)], [FormItem::image('image', 'Картинка')->required(true)]])]); return $form; });
<?php Admin::model('App\\Events')->title('События')->display(function () { $display = AdminDisplay::table(); $display->columns([Column::string('name')->label('Название'), Column::datetime('event_date')->label('Дата события'), Column::datetime('created_at')->label('Дата создания'), Column::datetime('updated_at')->label('Дата изменения')]); return $display; })->createAndEdit(function () { $form = AdminForm::form(); $form->items([FormItem::columns()->columns([[FormItem::text('name', 'Название'), FormItem::date('event_date', 'Дата события')]]), FormItem::columns()->columns([[FormItem::textarea('desc', 'Описание для главной')], [FormItem::ckeditor('desc_full', 'Подробное описание')]]), FormItem::columns()->columns([[FormItem::images('images', 'Фотографии для главной')]])]); return $form; });
<?php Admin::model(App\ColorOrden::class)->title('Orden de colores')->with()->filters(function () { })->columns(function () { Column::string('id', 'Id'); Column::string('codigo', 'Codigo'); })->form(function () { FormItem::text('id', 'Id')->attributes(["readonly" => "readonly"]); FormItem::text('codigo', 'Codigo'); FormItem::textarea('ordenes', 'Ordenes'); });
<?php \Admin::model('App\\Product')->title('Products')->alias('products')->display(function () { $display = AdminDisplay::datatablesAsync(); $display->columns([Column::checkbox(), Column::string('id')->label('#'), Column::string('title')->label('Загаловок'), Column::string('active_status')->label('Статус'), Column::string('publish')->label('Опубликован')]); return $display; })->createAndEdit(function () { $form = AdminForm::tabbed(); $form->items(['Main' => [FormItem::columns()->columns([[FormItem::text('title', 'Загаловок')->required()->unique(), FormItem::textarea('description', 'Описание')->required(), FormItem::timestamp('publish', 'Дата и время публикации')->defaultValue(Carbon\Carbon::now()), FormItem::icheckbox('active', 'Статус')->defaultValue(true), FormItem::text('rest', 'Остаток'), FormItem::text('price', 'Цена')], [FormItem::text('sort', 'сортировка'), FormItem::bsselect('user_id', 'Пользователь')->model('App\\User')->defaultValue(Sentinel::check()->id)->display('email'), FormItem::bsselect('catalog_id', 'Категоря')->model('App\\Catalog')->display('level_label')->disableSort()->required()]])], 'content' => [FormItem::markdown('content', 'Контент')], 'images' => [FormItem::images('gallery', 'Картинки')], 'files' => [FormItem::view('suroviy.soa_addon::admin.elfinder')]]); return $form; });
<?php Admin::model('App\\Form')->title('Form Items')->display(function () { $display = AdminDisplay::table(); $display->columns([Column::string('id')->label('ID'), Column::string('title')->label('String'), Column::datetime('created_at')->label('Created At')->format('d.m.Y H:i:s')]); return $display; })->createAndEdit(function () { $form = AdminForm::form(); $form->items([FormItem::columns()->columns([[FormItem::text('title', 'FormItem::text')->defaultValue('default value')->required(), FormItem::textaddon('textaddon', 'FormItem::textaddon')->addon('$')->placement('after'), FormItem::checkbox('checkbox', 'FormItem::checkbox'), FormItem::date('date', 'FormItem::date')->format('d.m.Y'), FormItem::time('time', 'FormItem::time')->format('H:i:s')->seconds(true), FormItem::timestamp('timestamp', 'FormItem::timestamp')->format('d.m.Y g:i A')], [FormItem::select('select', 'FormItem::select')->options([1 => 'First', 2 => 'Second', 3 => 'Third'])->nullable(), FormItem::custom()->display(function ($instance) { return view('custom_form_item', compact('instance')); })->callback(function ($instance) { $instance->custom = \Carbon\Carbon::now(); })], [FormItem::image('image', 'FormItem::image'), FormItem::images('images', 'FormItem::images')]]), FormItem::columns()->columns([[FormItem::textarea('textarea', 'FormItem::textarea')], [FormItem::ckeditor('ckeditor', 'FormItem::ckeditor')]])]); return $form; });
<?php \Admin::model('App\\LandingBlocks')->title('Landing blocks')->alias('landing-blocks')->display(function () { $display = AdminDisplay::table(); $display->apply(function ($query) { $query->orderBy('order', 'ASC'); }); $display->columns([Column::checkbox(), Column::string('id')->label('#'), Column::string('label')->label('Загаловок'), Column::order()]); return $display; })->edit(function ($id) { $form = AdminForm::tabbed(); $fields = []; $fields['Main'] = [FormItem::columns()->columns([[FormItem::text('label', 'Загаловок')->required()->unique(), FormItem::textarea('description', 'Описание'), FormItem::text('class', 'Класс'), FormItem::icheckbox('active', 'Статус')->defaultValue(true)], [FormItem::text('name', 'Имя блока')->required(), FormItem::text('landing_id', 'Landing')]])]; $model = App\LandingBlocks::find($id); if ($model) { $path = base_path('App' . DIRECTORY_SEPARATOR . 'AdminLanding' . DIRECTORY_SEPARATOR . str_replace('.', DIRECTORY_SEPARATOR, $model->name) . '.php'); if (is_file($path)) { $fields2 = (require_once $path); $fields = array_merge($fields, $fields2); } } $form->items($fields); return $form; })->create(function ($id) { $form = AdminForm::tabbed(); $fields = []; $fields['Main'] = [FormItem::columns()->columns([[FormItem::text('label', 'Загаловок')->required()->unique(), FormItem::textarea('description', 'Описание')->required(), FormItem::text('class', 'Класс'), FormItem::icheckbox('active', 'Статус')->defaultValue(true)], [FormItem::text('name', 'Имя блока')->required(), FormItem::text('landing_id', 'Landing')]])]; $form->items($fields); return $form; });
<?php /** * @var \SleepingOwl\Admin\Model\ModelConfiguration */ $model = Admin::model(\App\Page::class); $model->title('Страницы'); $model->display(function () { $display = AdminDisplay::datatables(); $display->filters([Filter::field('id')->title(function ($value) { return 'Выбрана страница с идентификатором: ' . $value; })]); $display->columns([Column::string('title')->label('Заголовок'), Column::published('published')->label('Опубликован')->orderable(false), Column::datetime('created_at')->label('Создан')->format('d.m.Y в H:i')]); $display->columnFilters([null, ColumnFilter::select()->options(['нет' => 'Нет', 'да' => 'Да'])->filter_field('published')]); return $display; })->createAndEdit(function ($id) use($model) { $model->title($id ? 'Редактировать страницу' : 'Создать страницу'); $form = AdminForm::tabbed(); $form->items(['Основное' => [FormItem::text('title', 'Заголовок')->required(), FormItem::checkbox('published', 'Опубликовать'), FormItem::ckeditor('content', 'Содержимое')], 'Мета данные' => [FormItem::textarea('meta_keywords', 'Ключевые слова')->rows(2), FormItem::textarea('meta_description', 'Описание страницы')->rows(4), FormItem::textarea('meta_others', 'Другая мета информация')->rows(7)]]); return $form; });
<?php Admin::model(\App\Noticia::class)->title('Noticias')->with()->filters(function () { })->columns(function () { Column::string('titulo', 'Titulo'); Column::string('habilitado', 'Habilitado'); Column::string('orden', 'Orden'); })->form(function () { FormItem::text('titulo', 'Titulo'); FormItem::textarea('bajada', 'Bajada'); FormItem::ckeditor('texto', 'Texto'); FormItem::checkbox('habilitado', 'Habilitado'); FormItem::select('orden', 'Orden')->enum([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15])->nullable(); FormItem::CustomImagenNoticia(); });
<?php \Admin::model('App\\Post')->title('Posts')->alias('posts')->display(function () { $display = AdminDisplay::table(); $display->columns([Column::checkbox(), Column::string('id')->label('#'), Column::string('title')->label('Загаловок'), Column::string('active_status')->label('Статус'), Column::string('publish')->label('Опубликован')]); return $display; })->createAndEdit(function () { $form = AdminForm::tabbed(); $form->items(['Main' => [FormItem::columns()->columns([[FormItem::text('title', 'Загаловок')->required()->unique(), FormItem::textarea('description', 'Описание')->required(), FormItem::timestamp('publish', 'Дата и время публикации')->defaultValue(Carbon\Carbon::now()), FormItem::icheckbox('active', 'Статус')->defaultValue(true)], [FormItem::text('alias', 'Алиас')->unique(), FormItem::bsselect('user_id', 'Пользователь')->model('App\\User')->defaultValue(Sentinel::check()->id)->display('email'), FormItem::bsselect('category_id', 'Категоря')->model('App\\Category')->display('level_label')->disableSort()->required(), FormItem::image('image', 'Картинка')]])], 'content' => [FormItem::markdown('content', 'Контент')]]); return $form; });
<?php Admin::model(App\Accesorio::class)->title('Accesorios')->with()->filters(function () { })->columns(function () { Column::string('codigo', 'Código'); Column::string('nombre', 'Nombre'); Column::string('categoria', 'Categoría'); Column::string('tipo', 'Tipo'); })->form(function () { FormItem::text('codigo', 'Código'); FormItem::text('nombre', 'Nombre'); FormItem::textarea('descripcion', 'Descripcion'); FormItem::CustomAccesorioCategoria(); FormItem::CustomAccesorioTipo(); });
<?php \Admin::model('App\\Landing')->title('Landing')->alias('landing')->display(function () { $display = AdminDisplay::table(); $display->with('blocks'); $display->columns([Column::checkbox(), Column::string('id')->label('#'), Column::string('title')->label('Загаловок'), Column::string('active_status')->label('Статус'), Column::custom()->label('Блоки')->callback(function ($instance) { return '<a href="/admin/landing-blocks?landing_id=' . $instance->id . '">Редактировать</a>'; })]); return $display; })->edit(function ($id) { $form = AdminForm::tabbed(); $fields = []; $fields['Main'] = [FormItem::columns()->columns([[FormItem::text('title', 'Загаловок')->required()->unique(), FormItem::textarea('description', 'Описание')->required(), FormItem::timestamp('publish', 'Дата и время публикации')->defaultValue(Carbon\Carbon::now()), FormItem::timestamp('publish_end', 'Дата и время олкончания публикация')->defaultValue(Carbon\Carbon::now()), FormItem::text('redirect', 'Редирект'), FormItem::icheckbox('active', 'Статус')->defaultValue(true)], [FormItem::text('alias', 'Алиас')->unique(), FormItem::text('name', 'Название')->required()->unique(), FormItem::image('image', 'Картинка')]])]; $model = App\Landing::find($id); if ($model) { $path = base_path('App/AdminLanding/' . $model->name . '.php'); if (is_file($path)) { $fields2 = (require_once $path); $fields = array_merge($fields, $fields2); } } $form->items($fields); return $form; })->create(function ($id) { $form = AdminForm::tabbed(); $fields = []; $fields['Main'] = [FormItem::columns()->columns([[FormItem::text('title', 'Загаловок')->required()->unique(), FormItem::textarea('description', 'Описание')->required(), FormItem::timestamp('publish', 'Дата и время публикации')->defaultValue(Carbon\Carbon::now()), FormItem::timestamp('publish_end', 'Дата и время олкончания публикация')->defaultValue(Carbon\Carbon::now()), FormItem::text('redirect', 'Редирект'), FormItem::icheckbox('active', 'Статус')->defaultValue(true)], [FormItem::text('alias', 'Алиас')->unique(), FormItem::text('name', 'Название')->required()->unique(), FormItem::image('image', 'Картинка')]])]; $form->items($fields); return $form; });
<?php Admin::model('App\\Contact3')->title('Contact')->alias('contacts3')->display(function () { $display = AdminDisplay::table(); $display->with('country', 'companies'); $display->filters([Filter::related('country_id')->model('App\\Country')]); $display->columns([Column::image('photo')->label('Photo'), Column::string('fullName')->label('Name'), Column::datetime('birthday')->label('Birthday')->format('d.m.Y'), Column::string('country.title')->label('Country')->append(Column::filter('country_id')), Column::lists('companies.title')->label('Companies')]); return $display; })->createAndEdit(function ($id) { $display = AdminDisplay::tabbed(); $display->tabs(function () use($id) { $tabs = []; $form = AdminForm::form(); $form->items([FormItem::columns()->columns([[FormItem::text('firstName', 'First Name')->required(), FormItem::text('lastName', 'Last Name')->required(), FormItem::text('phone', 'Phone'), FormItem::text('address', 'Address')], [FormItem::image('photo', 'Photo'), FormItem::date('birthday', 'Birthday')->format('d.m.Y')], [FormItem::select('country_id', 'Country')->model('App\\Country')->display('title'), FormItem::textarea('comment', 'Comment')]])]); $tabs[] = AdminDisplay::tab($form)->label('Main Form')->active(true); if (!is_null($id)) { $instance = App\Contact::find($id); if ($instance->country_id) { $country = Admin::model('App\\Country')->fullEdit($instance->country_id); $tabs[] = AdminDisplay::tab($country)->label('Form from Related Model (Country)'); } $companies = Admin::model('App\\Company')->display(); $companies->scope('withContact', $id); $companies->parameters(['contact_id' => $id]); $tabs[] = AdminDisplay::tab($companies)->label('Display from Related Model (Companies)'); } return $tabs; }); return $display; })->delete(null);
<?php Admin::model('App\\Models\\Advert')->title('Рекламные блоки')->display(function () { $display = AdminDisplay::datatables(); $display->with(); $display->filters([Filter::field('active')->title('Вкл')->alias('ddddd')]); $display->columns([Column::string('id')->label('Id'), Column::string('name')->label('Название'), Column::string('place')->label('Место'), Column::string('active')->label('Включен'), Column::image('img')->label('Img')]); return $display; })->createAndEdit(function () { $form = AdminForm::form(); $form->items([FormItem::columns()->columns([[FormItem::text('name', 'Название (только для админа)')], [FormItem::checkbox('active', 'Включен')]]), FormItem::columns()->columns([[FormItem::select('place', 'Место посадки')->enum(['top1', 'aside1', 'aside2', 'recipie_step', 'foot_script'])], []]), FormItem::columns()->columns([[FormItem::text('title', 'Заголовок')], [FormItem::checkbox('show_title', 'Показывать')]]), FormItem::columns()->columns([[FormItem::image('img', 'Изображение')], [FormItem::checkbox('show_img', 'Показывать'), FormItem::text('imglink', 'Ссылка')]]), FormItem::columns()->columns([[FormItem::textarea('text', 'Содержимое')], [FormItem::checkbox('show_text', 'Показывать')]])]); return $form; });
<?php Admin::model(\Pages::class)->title('Страницы')->with()->filters(function () { })->columns(function () { Column::string('id', 'ID'); Column::string('menu_title', 'Заголовок меню'); Column::string('title', 'Заголовок'); Column::string('is_published', 'Статус публикации'); Column::date('created_at', 'Дата создания')->format('medium', 'short'); Column::date('updated_at', 'Дата обновления')->format('medium', 'short'); Column::date('published_at', 'Дата публикации')->format('medium', 'short'); })->form(function () { // FormItem::select('parent_id', 'Родитель')->enum(Pages::whereIsContainer(1)->lists('menu_title', 'id')); FormItem::text('parent_id', 'Родитель'); FormItem::checkbox('is_published', 'Опубликовано'); FormItem::checkbox('is_container', 'Может быть родителем'); //FormItem::text('position', 'Позиция в меню'); FormItem::text('alias', 'Алиас'); FormItem::text('menu_title', 'Заголовок меню'); FormItem::text('title', 'Заголовок'); FormItem::timestamp('published_at', 'Дата публикации'); //->seconds(true); FormItem::textarea('meta_title', 'Мета-тег Title')->attributes(['rows' => 4]); FormItem::textarea('meta_desc', 'Мета-тег Description')->attributes(['rows' => 4]); FormItem::textarea('meta_key', 'Мета-тег Keywords')->attributes(['rows' => 4]); FormItem::ckeditor('introtext', 'Краткое описание'); FormItem::ckeditor('content', 'Контент'); });
<?php /* * This is a simple example of the main features. * For full list see documentation. */ Admin::model('App\\User')->title('Пользователи')->display(function () { $display = AdminDisplay::table(); $display->columns([Column::string('first_name')->label('Имя'), Column::string('last_name')->label('Фамилия'), Column::string('email')->label('Email')]); return $display; })->createAndEdit(function () { $form = AdminForm::form(); $form->items([FormItem::text('first_name', 'Имя')->required(), FormItem::text('last_name', 'Фамилия')->required(), FormItem::textarea('about', 'О Себе')->required(), FormItem::text('email', 'Email')->required()->unique()]); return $form; })->delete(function ($id) { if (in_array($id, [1])) { return null; } else { return 1; } });
<?php Admin::model(\App\Model\Category::class)->title('Категории Блога')->display(function () { $display = AdminDisplay::datatables(); $display->with('pages'); $display->filters([]); $display->columns([Column::string('title')->label('Название'), Column::count('pages.id')->label('Количество статей'), Column::action('show')->label('Label')->callback(function ($query) { return $query->active ? '✓' : '-'; })]); return $display; })->createAndEdit(function () { $form = AdminForm::tabbed(); $form->items(['Main' => [FormItem::hidden('user_id')->defaultValue(AdminAuth::user()->id), FormItem::text('title', 'Заголовок'), FormItem::text('slug', 'Slug - Заполняется автоматически'), FormItem::ckeditor('content', 'Content'), FormItem::textarea('descriptor', 'Краткое описание')]]); return $form; });
<?php Admin::model(App\Model\Page::class)->title('Страницы блога')->display(function () { $display = AdminDisplay::datatables(); $display->with('category'); $display->filters([]); $display->columns([Column::string('title')->label('Название'), Column::string('category.title')->label('Категория'), Column::action('show')->label('Label')->callback(function ($query) { return $query->active ? '✓' : '-'; })]); return $display; })->createAndEdit(function () { $form = AdminForm::tabbed(); $form->items(['Main' => [FormItem::hidden('user_id')->defaultValue(AdminAuth::user()->id), FormItem::select('category_id', 'Категория')->model(App\Model\Category::class), FormItem::text('title', 'Заголовок'), FormItem::text('slug', 'Slug - Заполняется автоматически'), FormItem::ckeditor('content', 'Content'), FormItem::textarea('descriptor', 'Краткое описание'), FormItem::checkbox('active', 'Активный')], 'Внешняя картинка' => [FormItem::image('image', 'Image')], 'Фоновая картика' => [FormItem::image('bg', 'Bg')]]); return $form; });
<?php \Admin::model('App\\Category')->title('Category')->alias('category')->display(function () { $display = AdminDisplay::tree(); $display->value('label|name'); return $display; })->createAndEdit(function () { $form = AdminForm::tabbed(); $form->items(['Main' => [FormItem::columns()->columns([[FormItem::text('label', 'Загаловок')->required()->unique(), FormItem::text('name', 'Название')->required()->unique(), FormItem::textarea('description', 'Описание'), FormItem::icheckbox('active_status', 'Статус')->defaultValue(true)], [FormItem::image('image', 'Картинка')]])], 'content' => [FormItem::markdown('content', 'Содержимое')]]); return $form; });
<?php /* * This is a simple example of the main features. * For full list see documentation. */ Admin::model('App\\Models\\User')->title('Users')->columns(function () { Column::image('avatar'); Column::string('name', 'Имя'); Column::string('surname', 'Фамилия'); Column::string('login', 'Login'); //Column::string('email', 'Email'); Column::string('description', 'Описание'); Column::string('group', 'Номер группы'); })->form(function () { FormItem::image('avatar', 'Аватар'); FormItem::text('name', 'Имя')->required(); FormItem::text('surname', 'Фамилия')->required(); FormItem::text('login', 'Login'); FormItem::text('email', 'Email')->unique(); FormItem::text('password', 'Пароль')->unique(); FormItem::textarea('description', 'Описание'); FormItem::text('group', 'Номер группы'); });
<?php //dd(Storage::files('archivos-imprentas')); Admin::model(\App\Orden::class)->title('Ordenes')->with()->filters(function () { })->columns(function () { Column::string('numero_de_orden', 'Numero de orden'); Column::date('valido_hasta', 'Valido Hasta')->format('medium', 'none'); Column::string('imprenta.nombre', 'Imprenta'); Column::Link('codigo', 'URL')->sortable(false); Column::action('email', 'email')->icon('fa-envelope-o')->style('short')->callback(function ($instance) { $imprenta = $instance->imprenta; Mail::send('email', ['imprenta' => $imprenta, 'orden' => $instance], function ($m) use($instance, $imprenta) { $m->from('*****@*****.**', 'Muriel Lodeiro'); $m->to($imprenta->email, $imprenta->contacto)->subject('Archivos disponibles para orden de compra: ' . $instance->numero_de_orden); }); //return Redirect::route('my-route', [$instance->id]); }); })->form(function () { FormItem::text('numero_de_orden', 'Numero De Orden'); FormItem::select('imprenta_id', 'Imprenta')->list(App\Imprenta::class); FormItem::date('valido_hasta', 'Valido Hasta'); FormItem::textarea('comentarios', 'Comentarios'); FormItem::archivosSelector('archivos_s', 'Archivos'); FormItem::archivosHidden('archivos', ''); });
return $instance->active ? '✓' : '-'; })]); return $display; })->create(function ($id) { $form = AdminForm::form(); $form->ajax_validation(true); $form->horizontal(true); $form->label_size('col-sm-offset-4 col-sm-1'); $form->field_size('col-sm-3'); $form->items([FormItem::text('title', 'Title')->validationRules('unique:pages,title,' . $id), FormItem::text('alias', 'Alias')->validationRules('unique:pages,alias,' . $id . ',id,context,' . Request::get('context', '')), FormItem::select('context', 'Context')->enum(config('jetcms.models.context')), FormItem::bsselect('user_id', 'User')->model('App\\User')->display('email|id')->defaultValue(Sentinel::check()->id)->nullable()]); return $form; })->edit(function ($id) { $model = App\Page::find($id); $form = AdminForm::tabbed(); $form->ajax_validation(true); $form->items(array('Main' => array(FormItem::columns()->columns([[FormItem::text('title', 'Title')->validationRules('unique:pages,title,' . $id), FormItem::text('alias', 'Alias')->validationRules('unique:pages,alias,' . $id . ',id,context,' . Request::get('context', '')), FormItem::textarea('description', 'Description'), FormItem::chosen('tag', 'Tag')->model('App\\Tag')->display('lable')->multi(true)->nullable(), FormItem::icheckbox('active')->label('Active')->skin('flat')], [FormItem::bsselect('menu_id', 'Menu id')->options(App\Menu::getNestedList('level_lable'))->disableSort()->nullable(), FormItem::select('context', 'Context')->enum(config('jetcms.models.context')), FormItem::select('template', 'Template')->enum(config('jetcms.models.template.' . $model->context, []))->nullable()->disableSort(), FormItem::select('policies', 'Policies')->enum(config('jetcms.models.policies.' . $model->context, []))->nullable()->disableSort(), FormItem::bsselect('user_id', 'User')->model('App\\User')->display('email|id')->defaultValue(Sentinel::check()->id)->nullable(), FormItem::image('image', 'Image')]]), FormItem::images('gallery', 'Gallery')), 'Content' => [FormItem::ckeditor('content', 'Text')], 'Fields' => value(function () use($id, $model) { //if (!$model) {return array();} return [FormItem::custom()->display(function ($instance) use($model) { $str = null; foreach (config('jetcms.models.fields.' . $instance->context, array()) as $val) { $type = $val['type']; $input = FormItem::$type('field_array.' . $val['name'] . '', $val['lable']); $input->defaultValue($instance->field($val['name'])); $str .= $input; } return $str; })->callback(function ($instance) { $instance->fieldArray = Request::input('field_array'); })]; }), 'Action' => [FormItem::custom()->display(function ($instance) { $str = null;