本文整理汇总了PHP中FormItem::image方法的典型用法代码示例。如果您正苦于以下问题:PHP FormItem::image方法的具体用法?PHP FormItem::image怎么用?PHP FormItem::image使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FormItem
的用法示例。
在下文中一共展示了FormItem::image方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
<?php
Admin::model('App\\Category')->title('Categorias')->display(function () {
$display = AdminDisplay::table();
$display->apply(function ($query) {
$query->orderBy('order', 'asc');
});
$display->columns([Column::string('name')->label('Nombre'), Column::count('products')->label('Productos'), Column::order()]);
return $display;
})->createAndEdit(function () {
$form = AdminForm::form();
$form->items([FormItem::text('name', 'Nombre'), FormItem::image('banner', 'Banner'), FormItem::ckeditor('description', 'Descripcion')]);
return $form;
});
示例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:
<?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;
});
示例4:
<?php
Admin::model(\App\Models\News::class)->title('News')->with()->filters(function () {
})->columns(function () {
Column::string('title', 'Title');
Column::date('date', 'Date')->format('medium', 'none');
Column::string('published', 'Published');
// Column::string('text', 'Text');
Column::image('photo', 'Photo')->sortable(false);
})->form(function () {
FormItem::text('title', 'Title')->required();
FormItem::date('date', 'Date')->required();
FormItem::checkbox('published', 'Published')->required();
FormItem::image('photo', 'Photo');
FormItem::ckeditor('text', 'Text')->required();
});
示例5:
<?php
Admin::model(App\Models\Category::class)->title('Категории')->with()->filters(function () {
})->columns(function () {
Column::string('id', 'ID');
Column::string('name', 'Название');
Column::string('alias', 'Альяс');
Column::image('image', 'Рисунок');
})->form(function () {
FormItem::text('name', 'Название');
FormItem::text('alias', 'Альяс');
FormItem::image('image', 'Рисунок');
});
示例6:
<?php
Admin::model('App\\MarkerGroup')->title('Группы маркеров')->display(function () {
$display = AdminDisplay::datatables();
$display->with('markers');
$display->filters([]);
$display->columns([Column::string('name')->label('Имя'), Column::string('id')->label('ID'), Column::lists('markers.name')->label('Маркеры')]);
return $display;
})->createAndEdit(function () {
$form = AdminForm::form();
$form->items([FormItem::text('name', 'Имя')->required(), FormItem::checkbox('showadd', 'Показывать в форме добавления рецепта'), FormItem::image('ico', 'Иконка'), FormItem::text('metakey', 'Meta Keywords'), FormItem::text('metadesk', 'Meta Description'), FormItem::multiselect('markers', 'Маркеры')->model('App\\Marker')->display('name')]);
return $form;
})->delete(function ($id) {
if (in_array($id, [1, 2, 3])) {
return null;
} else {
return 1;
}
});
示例7:
<?php
Admin::model('App\\Product')->title('Productos')->display(function () {
$display = AdminDisplay::datatables();
$display->with('colors');
// $display->filters([
// ]);
$display->columns([Column::image('thumbnail')->label('Miniatura'), Column::string('title')->label('Título'), Column::lists('colors.name')]);
return $display;
})->createAndEdit(function () {
$form = AdminForm::tabbed();
$form->items(['General' => [FormItem::text('title', 'Título'), FormItem::text('subtitle', 'Subtítulo'), FormItem::multiselect('colors', 'Colores')->model('App\\Color')->display('name'), FormItem::select('category_id', 'Categoria')->model('App\\Category')->display('name'), FormItem::text('tags', 'Serie')], 'Extra' => [FormItem::ckeditor('description', 'Descripcion'), FormItem::jsonField('specs', 'Especificaciones'), FormItem::ckeditor('details', 'Detalles')], 'Media' => [FormItem::image('thumbnail', 'Miniatura'), FormItem::images('images', 'Imagenes')], 'Venta' => [FormItem::text('price', 'Precio'), FormItem::text('link', 'Link a tienda nube')]]);
return $form;
});
示例8: view
<?php
Admin::model('App\\Models\\BlogPost')->title('Статьи блога')->display(function () {
$display = AdminDisplay::datatables();
$display->with('user', 'statusName');
$display->filters([]);
$display->columns([Column::string('id')->label('Id'), Column::string('title')->label('Заголовок'), Column::datetime('created_at')->label('Создан')->format('d.m.Y H:i'), Column::string('user.first_name')->label('Автор'), Column::string('statusName.name')->label('Статус')]);
return $display;
})->createAndEdit(function () {
$form = AdminForm::form();
$form->items([FormItem::text('title', 'Заголовок'), FormItem::image('img', 'Изображение'), FormItem::text('slug', 'Slug'), FormItem::select('user_id', 'Автор')->model('App\\User')->display('first_name')->defaultValue(1), FormItem::select('status', 'Статус')->model('App\\Models\\PostStatus')->display('name')->defaultValue(1), FormItem::text('metakey', 'Metakey'), FormItem::text('metadesc', 'Metadesc'), FormItem::ckeditor('text', 'Текст статьи'), FormItem::custom('newtags', 'sssssssssss')->display(function ($instance) {
return view('admin.formitem_tags', ['instance' => $instance]);
})->callback(function ($instance) {
$instance->retag($_POST['newtags']);
})]);
return $form;
});
示例9: 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;
});
示例10:
<?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;
});
示例11:
<?php
Admin::model(App\Models\Set_Of_Task::class)->title('')->with()->filters(function () {
})->columns(function () {
Column::string('name', 'Название');
Column::string('alias', 'Кратко');
Column::image('image')->sortable(false);
Column::string('type', 'Тип');
Column::string('description', 'Описание');
})->form(function () {
FormItem::text('name', 'Название');
FormItem::text('alias', 'Кратко');
FormItem::image('image', 'Изображение');
FormItem::text('type', 'Тип');
FormItem::ckeditor('description', 'Описание');
});
示例12: 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;
});
示例13:
<?php
Admin::model('App\\Models\\Product')->title('')->display(function () {
$display = AdminDisplay::datatables();
$display->with();
$display->filters([]);
$display->columns([Column::string('title')->label('Title'), Column::image('image')->label('Title'), Column::string('m_desc')->label('Description'), Column::string('price')->label('Price'), Column::string('discount')->label('Discount'), Column::custom()->label('Active')->callback(function ($instance) {
return $instance->active ? '✓' : '-';
})]);
return $display;
})->createAndEdit(function () {
$form = AdminForm::form();
$form->items([FormItem::text('title', 'Title')->required(), FormItem::text('slug', 'Slug')->required(), FormItem::text('m_desc', 'Mini Description')->required(), FormItem::ckeditor('f_desc', 'Full Description')->required(), FormItem::image('image', 'Image')->required(), FormItem::select('server_id', 'Server')->model('App\\Models\\Server')->display('name')->required(), FormItem::text('command', 'Command')->required(), FormItem::text('price', 'Price')->required(), FormItem::text('discount', 'Discount')->defaultValue(0)->required()->validationRule(['numeric', 'max:99']), FormItem::checkbox('countable', 'Countable'), FormItem::checkbox('active', 'Active')]);
return $form;
});
示例14: 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;
});
示例15: 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;
});