本文整理汇总了PHP中FormItem::time方法的典型用法代码示例。如果您正苦于以下问题:PHP FormItem::time方法的具体用法?PHP FormItem::time怎么用?PHP FormItem::time使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FormItem
的用法示例。
在下文中一共展示了FormItem::time方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
<?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']);
});
示例2: 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;
});
示例3:
<?php
/**
* Created by PhpStorm.
* User: nursultan
* Date: 3-Jul 15
* Time: 22:50
*/
Admin::model(\App\Field::class)->title('Fields')->with('infrastructures', 'city', 'category', 'cover')->columns(function () {
Column::string('name', 'Name');
Column::string('opens', 'Opens');
Column::string('closes', 'Closes');
Column::string('roof', 'Roof');
Column::string('price', 'Price');
Column::string('phoneNumber', 'PhoneNumber');
Column::string('address', 'Address');
Column::string('description', 'Description');
Column::string('longitude', 'Longitude');
Column::string('latitude', 'Latitude');
})->form(function () {
FormItem::text('name');
FormItem::time('opens');
FormItem::time('closes');
FormItem::checkbox('roof', 'Roof');
FormItem::textAddon('price')->addon('Сом')->placement('after');
FormItem::text('phoneNumber');
FormItem::text('address');
FormItem::textarea('description');
FormItem::text('longitude');
FormItem::text('latitude');
});
示例4:
<?php
Admin::model(App\Models\Mega::class)->title('Megas')->with()->filters(function () {
})->columns(function () {
Column::string('string', 'String');
})->form(function () {
FormItem::text('string', 'String')->required();
FormItem::text('integer', 'Integer')->required()->validationRule('integer');
FormItem::image('image', 'Image');
FormItem::checkbox('boolean', 'Boolean');
FormItem::date('date', 'Date')->required();
FormItem::time('time', 'Time')->required();
//->seconds(true);
FormItem::select('choices', 'Choices')->enum(['foo', 'bar']);
FormItem::ckeditor('text', 'Text')->required();
});