本文整理汇总了PHP中FormItem::view方法的典型用法代码示例。如果您正苦于以下问题:PHP FormItem::view方法的具体用法?PHP FormItem::view怎么用?PHP FormItem::view使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FormItem
的用法示例。
在下文中一共展示了FormItem::view方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
<?php
Admin::model('Cartalyst\\Sentinel\\Users\\EloquentUser')->title('Юзеры')->display(function () {
$display = AdminDisplay::datatables();
$display->with();
$display->filters([]);
$display->columns([Column::string('id')->label('Id'), Column::string('email')->label('Email'), Column::string('first_name')->label('Имя')]);
return $display;
})->create(function () {
$form = AdminForm::form();
$form->items([FormItem::columns()->columns([[FormItem::text('email', 'Email'), FormItem::password('password', 'Пароль'), FormItem::password('password_confirm', 'Подтверждение пароля')], [FormItem::text('first_name', 'Имя'), FormItem::text('last_name', 'Фамилия'), FormItem::view('admin.user_create')]])]);
return $form;
})->edit(function () {
$form = AdminForm::form();
$form->items([FormItem::columns()->columns([[FormItem::text('email', 'Email'), FormItem::password('password', 'Пароль'), FormItem::password('password_confirm', 'Подтверждение пароля')], [FormItem::text('first_name', 'Имя'), FormItem::text('last_name', 'Фамилия'), FormItem::view('admin.user_update')]])]);
return $form;
});
示例2:
<?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;
});
示例3:
<?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');
});