本文整理汇总了PHP中FormItem::columns方法的典型用法代码示例。如果您正苦于以下问题:PHP FormItem::columns方法的具体用法?PHP FormItem::columns怎么用?PHP FormItem::columns使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FormItem
的用法示例。
在下文中一共展示了FormItem::columns方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: use
<?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);
示例2:
<?php
Admin::model('App\\News')->title('Noticias')->display(function () {
$display = AdminDisplay::datatables();
$display->with('gallery');
$display->filters([Filter::related('gallery_id')->model('App\\Gallery')]);
$display->columns([Column::image('thumbnail'), Column::string('title')->label('Title'), Column::string('short_text')->label('Short_text')]);
return $display;
})->createAndEdit(function () {
$form = AdminForm::form();
$form->items([FormItem::columns()->columns([[FormItem::text('title', 'Title'), FormItem::text('short_text', 'Shorttext'), FormItem::select('gallery_id', 'Galería')->model('App\\Gallery')->display('title'), FormItem::ckeditor('text', 'Text')], [FormItem::checkbox('pin', 'Destacada'), FormItem::image('thumbnail', 'Thumbnail')]])]);
return $form;
});
示例3: use
<?php
$model = Admin::model('App\\Configuration');
$model->title('Configuración')->display(function () {
$display = AdminDisplay::datatables();
$display->with();
$display->filters([]);
$display->columns([Column::string('key')->label('Opcion')]);
return $display;
})->createAndEdit(function ($algo) use($model) {
if (!$algo) {
return null;
}
Session::flash('_redirectBack', $model->displayUrl());
$form = AdminForm::tabbed();
$form->items(['Home' => [FormItem::select('home_slider', 'Slider principal')->model('App\\Gallery')->display('title'), FormItem::columns()->columns([[FormItem::image('home_octeam')->label('team')], [FormItem::image('home_ocwarranty')->label('warranty')], [FormItem::image('home_ocstores')->label('stores')]]), FormItem::image('home_middle_banner')->label('Banner del medio')], 'Navegacion' => [FormItem::select('best_seller', 'Best Seller')->model('App\\Product')->display('title')], 'Footer' => [FormItem::image('ventas_mayoristas')->label('Ventas Mayoristas')], 'Banners de páginas' => [FormItem::image('news_banner')->label('News'), FormItem::image('team_banner')->label('Team'), FormItem::image('warranty_banner')->label('Warranty'), FormItem::image('about_banner')->label('About'), FormItem::select('stores_banner', 'Slider de Stores')->model('App\\Gallery')->display('title')->label('Galería de Stores')]]);
return $form;
});
示例4:
<?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;
});
示例5:
if ($instance->active) {
return ' <span><i class="fa fa-chevron-down" data-toggle="tooltip" title="" data-original-title="Active"></i></span>';
}
})->orderable(false)]);
return $display;
})->createAndEdit(function () {
$form = AdminForm::form();
$form->ajax_validation(true);
$form->items([FormItem::columns()->columns([[FormItem::text('lable', 'lable'), FormItem::bsselect('user_id', 'User')->model('App\\User')->display('email')->defaultValue(Sentinel::getUser()->id), FormItem::icheckbox('active')->label('Active')->skin('flat')], [FormItem::text('comment_id', 'Page ID'), FormItem::text('comment_type')]]), FormItem::ckeditor('content', 'Content')]);
return $form;
});
/**
* Sitemaps
*/
Admin::model('App\\Sitemap')->title('Sitemap')->alias('sitemaps')->display(function () {
$display = AdminDisplay::table();
$display->filters([Filter::field('loc')->title(function ($value) {
return 'URL:' . $value;
})]);
$display->columns([Column::checkbox(), Column::string('loc')->label('loc'), Column::string('lastmod')->label('lastmod'), Column::string('changefreq')->label('changefreq'), Column::string('priority')->label('priority'), Column::string('updated_at')->label('updated_at'), Column::custom()->label('in_sitemap')->callback(function ($instance) {
if ($instance->in_sitemap) {
return ' <span><i class="fa fa-chevron-down" data-toggle="tooltip" title="" data-original-title="Active"></i></span>';
}
})->orderable(false)]);
return $display;
})->createAndEdit(function () {
$form = AdminForm::form();
$form->ajax_validation(true);
$form->items([FormItem::columns()->columns([[FormItem::text('loc', 'loc')->required(), FormItem::timestamp('lastmod', 'lastmod')->required(), FormItem::select('changefreq', 'changefreq')->enum(['always', 'hourly', 'daily', 'weekly', 'monthly', 'yearly', 'never'])->required(), FormItem::text('priority', 'priority')->required(), FormItem::icheckbox('in_sitemap')->label('In sitemap')]])]);
return $form;
});
示例6:
<?php
Admin::model('App\\Directions')->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::ckeditor('desc', 'Описание'), FormItem::ckeditor('desc_detail', 'Описание'), FormItem::text('video', 'Видео')], [FormItem::images('images', 'Картинки')]])]);
return $form;
});
示例7:
<?php
Admin::model(\App\Models\Menuitem::class)->title('Пункты меню')->display(function () {
$display = AdminDisplay::datatables();
$display->with();
$display->filters([]);
$display->columns([Column::string('name')->label('Название'), Column::string('menu.name'), Column::string('id')->label('Id')]);
return $display;
})->createAndEdit(function () {
$form = AdminForm::form();
$form->items([FormItem::columns()->columns([[FormItem::text('name', 'Название'), FormItem::text('target', 'Ссылка (Если тип НЕ Группа маркеров)'), FormItem::select('parent_id', 'Родительский пункт')->defaultValue(0)->model('App\\Models\\Menuitem')->display('name'), FormItem::select('type_id', 'Тип пункта')->model('App\\Models\\MenuitemType')->display('name')], [FormItem::select('menu_id', 'В какое меню входит')->model('App\\Models\\Menu')->display('name'), FormItem::select('markerGroup_id', 'Группа маркеров (если тип пункта Группа Маркеров)')->model('App\\MarkerGroup')->display('name'), FormItem::select('marker_id', 'Маркер (если тип пункта Маркер)')->model('App\\Marker')->display('name')]])]);
return $form;
});
示例8:
<?php
Admin::model('App\\Groups')->title('Наборы')->display(function () {
$display = AdminDisplay::table();
$display->columns([Column::string('name')->label('Название'), Column::string('desc')->label('Описание')]);
return $display;
})->createAndEdit(function () {
$form = AdminForm::form();
$form->items([FormItem::columns()->columns([[FormItem::text('name', 'Название'), FormItem::ckeditor('desc', 'Описание')]])]);
return $form;
});
示例9: view
<?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;
});
示例10:
<?php
Admin::model('App\\User')->title('Users')->display(function () {
$display = AdminDisplay::datatables();
$display->columns([Column::string('name')->label('Name'), Column::string('email')->label('Email')]);
return $display;
})->createAndEdit(function () {
$form = AdminForm::form();
$form->items([FormItem::columns()->columns([[FormItem::text('name', 'Name')->required(), FormItem::text('email', 'Email')->required()->unique()], []])]);
return $form;
});
示例11:
<?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;
});
示例12: base_path
<?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;
});
示例13: use
<?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;
});
示例14:
<?php
Admin::model('App\\Albums')->title('Альбомы')->display(function () {
$display = AdminDisplay::table();
$display->columns([Column::string('events.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::select('events_id', 'Событие')->model('App\\Events')->display('name')]]), FormItem::columns()->columns([[FormItem::images('images', 'Фотографии')]])]);
return $form;
});
示例15:
<?php
Admin::model(\App\Models\Post::class)->title('Блог')->display(function () {
$display = AdminDisplay::datatables();
$display->columns([Column::string('id')->label('#'), Column::string('title')->label('Заголовок'), Column::custom()->label('Опубликован')->callback(function ($instance) {
return $instance->published ? 'Да' : 'Нет';
}), Column::datetime('created_at')->label('Дата создания')]);
return $display;
})->createAndEdit(function () {
$form = AdminForm::form();
$form->items([FormItem::columns()->columns([[FormItem::checkbox('published', 'Опубликован')->defaultValue(1), FormItem::text('title', 'Заголовок')->required(), FormItem::ckeditor('body', 'Текст')->required()]])]);
return $form;
});