本文整理汇总了PHP中Column::image方法的典型用法代码示例。如果您正苦于以下问题:PHP Column::image方法的具体用法?PHP Column::image怎么用?PHP Column::image使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Column
的用法示例。
在下文中一共展示了Column::image方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
<?php
Admin::model(App\Product::class)->title('Управление товарами')->display(function () {
$display = AdminDisplay::datatables();
$display->with('category');
$display->filters([Filter::related('category_id')->model(App\Category::class)]);
$display->columns([Column::string('name')->label('Название'), Column::string('price')->label('Цена'), Column::image('image')->label('Изображение'), Column::string('category.title')->label('Категория')->append(Column::filter('category_id')), Column::custom()->label('Топ')->callback(function ($instance) {
return $instance->active ? 'да' : 'нет';
}), Column::string('product_rest')->label('Остаток')]);
return $display;
})->createAndEdit(function () {
$form = AdminForm::form();
$form->items([FormItem::text('name', 'Название'), FormItem::text('slug', 'Slug'), FormItem::text('price', 'Цена'), FormItem::image('image', 'Изображение'), FormItem::select('category_id', 'Категория')->model(App\Category::class)->display('title'), FormItem::checkbox('active', 'Топ'), FormItem::ckeditor('description', 'Описание'), FormItem::text('product_rest', 'Количество товара')->defaultValue('0')]);
return $form;
});
示例2:
<?php
Admin::model(App\Models\Task::class)->title('Задачи')->with('subject')->filters(function () {
})->columns(function () {
Column::string('number_task', 'Number_task');
Column::image('image')->sortable(false);
Column::string('experience', 'Experience');
Column::string('gold', 'Gold');
Column::string('grade', 'Grade');
Column::string('subject.name', 'Subject')->append(Column::filter('subject_id')->value('subject_id'));
Column::string('answer', 'Answer');
Column::string('detail', 'detail');
Column::string('set_of_task', 'Set_of_task');
})->form(function () {
FormItem::text('number_task', 'Number Task');
FormItem::image('image', 'Image');
FormItem::text('experience', 'Experience');
FormItem::text('gold', 'Gold');
FormItem::text('grade', 'Grade');
FormItem::select('subject_id', 'Subject')->list(App\Models\Subject::class);
FormItem::text('answer', 'Answer');
FormItem::text('detail', 'detail');
FormItem::text('set_of_task', 'Set Of Task');
});
示例3: 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);
示例4:
<?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', 'Рисунок');
});
示例5:
<?php
/**
* Created by IntelliJ IDEA.
* User: yarik
* Date: 20.10.15
* Time: 21:22
*/
Admin::model(\App\Slider::class)->title('Slider')->alias('slider')->display(function () {
$display = AdminDisplay::table();
$display->columns([Column::string('active')->label('Active'), Column::string('position')->label('Position'), Column::string('title')->label('Title'), Column::string('url')->label('Url'), Column::image('image')->label('Image')]);
return $display;
})->createAndEdit(function () {
$form = AdminForm::form();
$form->items([FormItem::text('active', 'Active')->required(), FormItem::text('position', 'Position')->required(), FormItem::text('title', 'Title')->required(), FormItem::text('url', 'url')->required(), FormItem::image('image', 'Photo')->required()]);
return $form;
});
示例6:
<?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;
});
示例7:
<?php
Admin::model('App\\Product')->title('Товары')->display(function () {
$display = AdminDisplay::datatables();
$display->columns([Column::string('id')->label('ID'), Column::string('title')->label('Название'), Column::string('ym_url')->label('ЯМ ссылка')->append(Column::url('ym_url')), Column::image('image_url')->label('Ссылка на картинку')]);
$display->columnFilters([null, ColumnFilter::text()->placeholder('Товар'), null, null]);
return $display;
})->createAndEdit(function () {
$form = AdminForm::form();
$form->items([FormItem::text('title', 'Название')->required(), FormItem::text('ym_url', 'ЯМ ссылка')->required(), FormItem::text('image_url', 'Ссылка на картинку')->required()]);
return $form;
});
示例8: 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;
});
示例9:
<?php
/*
* This is a simple example of the main features.
* For full list see documentation.
*/
Admin::model('Crimibook\\Models\\Status')->title('Status')->display(function () {
$display = AdminDisplay::datatables();
$display->with();
$display->filters([Filter::related('user_id')->model('Crimibook\\User')]);
$display->columns([Column::string('users.name')->label('Owner')->append(Column::filter('user_id')), Column::string('body')->label('Text'), Column::string('image_path')->label('Photo path'), Column::image('image_path')->label('Photo')]);
return $display;
})->createAndEdit(function () {
$form = AdminForm::form();
$form->items([FormItem::select('user_id', 'User')->model('Crimibook\\User')->display('name')->required(), FormItem::text('body', 'Body')->required(), FormItem::text('image_path', 'Photo')]);
return $form;
});
示例10:
<?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;
});
示例11: dd
<?php
Admin::model('App\\Contact')->title('Contacts')->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<br/><small>(image)</small>'), Column::string('fullName')->label('Name<br/><small>(string with accessor)</small>'), Column::datetime('birthday')->label('Birthday<br/><small>(datetime)</small>')->format('d.m.Y'), Column::string('country.title')->label('Country<br/><small>(string from related model)</small>')->append(Column::filter('country_id')), Column::count('companies')->label('Companies<br/><small>(count)</small>'), Column::lists('companies.title')->label('Companies<br/><small>(lists)</small>'), Column::custom()->label('Has Photo?<br/><small>(custom)</small>')->callback(function ($instance) {
return $instance->photo ? '✓' : '-';
}), Column::action('my_action')->label('<small>(action)</small>')->value('Custom action')->target('_blank')->callback(function ($instance) {
dd('Custom action called with instance:', $instance->toArray());
})]);
return $display;
})->createAndEdit(null)->delete(null);
示例12:
<?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;
});
示例13:
<?php
Admin::model('\\Contact')->title('Contacts')->with('country', 'companies')->filters(function () {
ModelItem::filter('country_id')->title()->from('\\Country');
ModelItem::filter('withoutCompanies')->scope('withoutCompanies')->title('without companies');
})->columns(function () {
Column::image('photo');
Column::string('full_name', 'Name')->orderBy('lastName')->sortableDefault();
Column::date('birthday', 'Birthday')->format('medium', 'none');
Column::string('country.title', 'Country')->append(Column::filter('country_id')->value('country.id'));
Column::lists('companies.title', 'Companies');
Column::action('show', 'Custom action')->target('_blank')->icon('fa-globe')->style('long')->callback(function ($instance) {
echo 'You are trying to call custom action "show" with row id "' . $instance->id . '"';
die;
});
})->form(function () {
FormItem::text('firstName', 'First Name')->required();
FormItem::text('lastName', 'Last Name')->required();
FormItem::image('photo', 'Photo');
FormItem::date('birthday', 'Birthday');
FormItem::text('phone', 'Phone');
FormItem::text('address', 'Address');
FormItem::select('country_id', 'Country')->list('\\Country')->required();
FormItem::multiSelect('companies', 'Companies')->list('\\Company')->value('companies.company_id');
FormItem::ckeditor('comment', 'Comment');
FormItem::view('admin.form.comment');
});
示例14:
<?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();
});
示例15:
<?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', 'Номер группы');
});