本文整理汇总了PHP中FormItem::hidden方法的典型用法代码示例。如果您正苦于以下问题:PHP FormItem::hidden方法的具体用法?PHP FormItem::hidden怎么用?PHP FormItem::hidden使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FormItem
的用法示例。
在下文中一共展示了FormItem::hidden方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
<?php
Admin::model('App\\Company')->title('Companies')->display(function () {
$display = AdminDisplay::table();
$display->columns([Column::string('title')->label('Title'), Column::string('address')->label('Address')]);
return $display;
})->createAndEdit(function ($id) {
$form = AdminForm::form();
$form->items([FormItem::hidden('contact_id'), FormItem::text('title', 'Title')->required()->unique(), FormItem::text('address', 'Address'), FormItem::text('phone', 'Phone')]);
return $form;
});
示例2:
/*
* This is a simple example of the main features.
* For full list see documentation.
*/
// Create admin model from User class with title and url alias
// Admin::model(App\User::class)
// ->title('Users')
// ->as('users-alias-name')->denyCreating(function ()
// {
// // Deny creating on thursday
// return date('w') == 4;
// })->display(function ()
// {
// // Describing columns for table view
// Column::string('name', 'Name');
// Column::string('email', 'Email');
// })->createAndEdit(function ()
// {
// // Describing elements in create and editing forms
// FormItem::text('name', 'Name');
// FormItem::text('email', 'Email');
// });
Admin::model(App\Announcement::class)->title('announcements')->display(function () {
$display = AdminDisplay::datatables();
$display->columns([Column::string('title')->label('Title'), Column::string('message')->label('message')]);
return $display;
})->createAndEdit(function () {
$form = AdminForm::form();
$form->items([FormItem::columns()->columns([[FormItem::hidden('id'), FormItem::text('title', 'Title')->required()->unique(), FormItem::text('message', 'message')]])]);
return $form;
});
示例3:
<?php
Admin::model(\App\Model\Category::class)->title('Категории Блога')->display(function () {
$display = AdminDisplay::datatables();
$display->with('pages');
$display->filters([]);
$display->columns([Column::string('title')->label('Название'), Column::count('pages.id')->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::text('title', 'Заголовок'), FormItem::text('slug', 'Slug - Заполняется автоматически'), FormItem::ckeditor('content', 'Content'), FormItem::textarea('descriptor', 'Краткое описание')]]);
return $form;
});
示例4:
<?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;
});