本文整理汇总了PHP中FormItem::select方法的典型用法代码示例。如果您正苦于以下问题:PHP FormItem::select方法的具体用法?PHP FormItem::select怎么用?PHP FormItem::select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FormItem
的用法示例。
在下文中一共展示了FormItem::select方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
<?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;
});
示例2: use
<?php
/** @var \SleepingOwl\Admin\Model\ModelConfiguration $model */
$model = Admin::model(\App\HistoryEvent::class);
$model->title('История – события');
$model->display(function () {
$display = AdminDisplay::datatables();
$display->with('date');
$display->columns([Column::checkbox(), Column::string('date.title')->label('Дата'), Column::custom()->label('Заголовок')->callback(function ($instance) {
$res = $instance->title;
if ($instance->more) {
$res .= '<br><div class="label label-primary">Кнопка – подробней</div>';
}
return $res;
}), Column::datetime('date_event')->format('d.m.Y')->label('Точная дата события'), Column::datetime('created_at')->label('Создан')->format('d.m.Y в H:i')]);
$display->apply(function (\Illuminate\Database\Eloquent\Builder $query) {
$query->withTrashed();
});
return $display;
})->createAndEdit(function ($id) use($model) {
$model->title($id ? 'Редактировать событие' : 'Создать событие');
$form = AdminForm::form();
$form->items([FormItem::text('title', 'Заголовок'), FormItem::image('image', 'Картинка'), FormItem::select('history_date_id', 'Дата')->model(\App\HistoryDate::class)->display('title')->required(), FormItem::ckeditor('description', 'Описание')->required(), FormItem::date('date_event', 'Точная дата события'), FormItem::checkbox('more', 'Показать кнопку – подробней')]);
return $form;
});
示例3:
<?php
Admin::model(App\TimeSlot::class)->title('Time Slots')->with()->filters(function () {
})->columns(function () {
Column::string('id', 'ID');
Column::date('start', 'Start')->format('none', 'short');
Column::date('end', 'End')->format('none', 'short');
Column::earlyLate('type', 'Type');
})->form(function () {
FormItem::time('start', 'Start')->required();
FormItem::time('end', 'End')->required();
FormItem::select('type', 'Type')->list([1 => 'Early', 0 => 'Late']);
});
示例4:
<?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');
});
示例5:
<?php
Admin::model(App\Category::class)->title('Category')->with()->filters(function () {
})->columns(function () {
Column::string('name', 'Name');
Column::string('description', 'Description');
Column::string('classification.name', 'Classification');
})->form(function () {
FormItem::text('name', 'Name');
FormItem::text('description', 'Description');
FormItem::select('classification_id', 'Classification')->list(\App\Classification::class);
});
示例6:
<?php
Admin::model('App\\UserProduct')->title('Юзер-Товар')->display(function () {
$display = AdminDisplay::datatables();
$display->columns([Column::string('id')->label('ID'), Column::string('user.name')->label('Юзер'), Column::string('product.title')->label('Товар'), Column::string('review')->label('Отзыв'), Column::string('status')->label('Статус'), Column::string('sum')->label('Сумма'), Column::string('created_at')->label('Дата'), Column::string('updated_at')->label('Обновлено')]);
$display->columnFilters([null, ColumnFilter::text()->placeholder('Юзер'), null, null, null, null, ColumnFilter::range()->from(ColumnFilter::date()->format('d.m.Y')->placeholder('С'))->to(ColumnFilter::date()->format('d.m.Y')->placeholder('По')), null]);
return $display;
})->edit(function () {
$form = AdminForm::form();
$form->items([FormItem::select('user_id', 'Юзер')->model('App\\User')->display('name')->required(), FormItem::select('product_id', 'Товар')->model('App\\Product')->display('title')->required(), FormItem::text('review', 'Отзыв'), FormItem::select('status', 'Статус')->enum(['M', 'A', 'D', 'R'])->nullable()]);
return $form;
})->create(function () {
$form = AdminForm::form();
$form->items([FormItem::select('user_id', 'Юзер')->model('App\\User')->display('name')->required(), FormItem::select('product_id', 'Товар')->model('App\\Product')->display('title')->required()]);
return $form;
});
示例7: view
<?php
Admin::model('\\App\\Category')->title('Управление категориями')->display(function () {
$instance = new App\Category();
$message = Session::get('message');
//('message') ? $message : '';
$categories = $instance->createTree(1);
return view('admin.categories', compact('categories', 'message'));
})->createAndEdit(function ($id) {
$form = AdminForm::form();
$form->items([FormItem::text('title', 'Название категории')->required(), FormItem::select('parent_id', 'Родительская категория')->model('App\\Category')->display('title')->required(), FormItem::checkbox('active', 'Активность')]);
return $form;
});
示例8:
<?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;
});
示例9:
<?php
Admin::model('\\App\\Training_Resource')->title('Recursos de formació')->with()->filters(function () {
})->columns(function () {
//Column::image('training_resource_thumbnail');
Column::string('training_resource_id', 'ID');
Column::string('training_resource_name', 'Nom');
//Column::string('training_resource_short_name', 'Nom Curt');
Column::string('training_resource_description', 'Descripció');
//Column::string('training_resource_external_url', 'URL');
//Column::string('training_resource_name', 'Pare')->append(Column::where('training_resource_id', '=', 'training_resource_parentResourceId'));
Column::string('parent.training_resource_name', 'Pare');
})->form(function () {
FormItem::text('training_resource_name', 'Nom')->required();
FormItem::text('training_resource_short_name', 'Nom Curt');
FormItem::image('training_resource_thumbnail', 'Imatge');
FormItem::text('training_resource_external_url', 'URL Externa');
FormItem::select('training_resource_parentResourceId', 'Pare')->list('\\App\\Training_Resource')->nullable();
//FormItem::timestamp('training_resource_entryDate', 'Data Creació');//->seconds(true);
//FormItem::timestamp('training_resource_last_update', 'Data de l\'última modificació');//->seconds(true);
FormItem::checkbox('training_resource_softDeleted', 'SoftDeleted');
FormItem::ckeditor('training_resource_description', 'Descripció');
//FormItem::text('training_resource_creationUserId', 'Training Resource Creation User Id');
//FormItem::text('training_resource_lastupdateUserId', 'Training Resource Lastupdate User Id');
//FormItem::timestamp('training_resource_softDeletedDate', 'Training Resource Soft Deleted Date');//->seconds(true);
});
示例10:
<?php
Admin::model(App\Booth::class)->title('Booths')->with('location', 'day', 'time_slot')->filters(function () {
})->columns(function () {
Column::string('id', 'ID');
Column::string('location.name', 'Location');
Column::string('day.date', 'Date');
Column::string('time_slot.slot', 'Time');
Column::string('user_id', 'Troop');
Column::string('total', 'Total');
})->form(function () {
FormItem::select('location_id', 'Location')->list('App\\Location')->required();
FormItem::select('day_id', 'Day')->list('App\\Day')->required();
FormItem::select('time_slot_id', 'Time Slot')->list('App\\TimeSlot')->required();
FormItem::select('user_id', 'Troop')->list('App\\User')->nullable();
FormItem::text('total', 'Total');
});
示例11: function
};
break;
case 'orders_status_id':
return function () {
InlineEditItem::select('orders_status_id', NULL)->list(Models\OrdersStatus::class);
};
break;
case 'total':
return function () {
InlineEditItem::text('total', NULL)->validationRule('required|regexp:\\d');
};
break;
default:
return function () {
};
break;
}
})->form(function () {
FormItem::select('customer_id', 'Customer')->list(Models\Customer::class)->validationRule('required|numeric|exists:customers,id')->group('general');
FormItem::select('orders_status_id', 'Status')->list(Models\OrdersStatus::class)->validationRule('required|numeric|exists:orders_statuses,id')->group('general');
FormItem::text('total', 'Total')->validationRule('required|numeric|min:1')->group('general');
FormItem::items('items', 'Items')->group('items');
FormGroup::create('general', 'General')->setDisplayType(FormGroup::DISPLAY_TYPE_FULL);
FormGroup::create('items', 'Items')->setDisplayType(FormGroup::DISPLAY_TYPE_FULL);
})->viewFilters(function () {
ViewFilter::text('customer.login', 'Customer');
ViewFilter::dropdown('orders_status_id', 'Status')->options(function () {
$options = [['id' => '', 'name' => '- Status -']];
return array_merge($options, App\Models\Repositories\OrdersStatusRepository::getOptionsList());
});
});
示例12:
<?php
Admin::model('Lanz\\Commentable\\Comment')->title('Комментарии')->display(function () {
$display = AdminDisplay::datatables();
$display->with();
$display->filters([]);
$display->columns([Column::string('body')->label('Комментарий'), Column::datetime('created_at')]);
return $display;
})->createAndEdit(function ($id) {
if (is_null($id)) {
return null;
}
$form = AdminForm::form();
$form->items([FormItem::select('user_id', 'Автор')->model('App\\User')->display('first_name'), FormItem::ckeditor('body', 'Комментарий')]);
return $form;
});
示例13:
<?php
Admin::model(App\Location::class)->title('Locations')->with()->filters(function () {
})->columns(function () {
Column::string('id', 'ID');
Column::string('name', 'Name');
Column::string('address', 'Address');
Column::string('notes', 'Notes');
Column::lowHigh('type', 'Type')->sortable(false);
Column::active('status', 'Status');
})->form(function () {
FormItem::text('name', 'Name')->required();
FormItem::text('address', 'Address');
FormItem::select('type', 'Type')->list([0 => 'High yield', 1 => 'Low yield']);
FormItem::select('status', 'Status')->list([1 => 'Active', 0 => 'Inactive'])->required();
FormItem::ckeditor('notes', 'Notes');
});
示例14:
<?php
Admin::model(App\Models\Article::class)->title('Новости')->with()->filters(function () {
})->columns(function () {
Column::string('name', 'Заголовок');
Column::category('category_id', 'Категория');
Column::string('alias', 'Альяс');
Column::image('image')->sortable(false);
})->form(function () {
FormItem::select('category_id', 'Категория')->list(\App\Models\Category::class)->required();
FormItem::text('name', 'Заголовок');
FormItem::text('alias', 'Альяс');
FormItem::image('image', 'Рисунок');
FormItem::ckeditor('intro', 'Интро');
FormItem::ckeditor('text', 'Текст');
});
示例15: 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);