本文整理汇总了PHP中FormItem::date方法的典型用法代码示例。如果您正苦于以下问题:PHP FormItem::date方法的具体用法?PHP FormItem::date怎么用?PHP FormItem::date使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FormItem
的用法示例。
在下文中一共展示了FormItem::date方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
<?php
Admin::model('App\\News4')->title('News')->alias('news4')->display(function () {
$display = AdminDisplay::table();
$display->filters([Filter::scope('last')->title('Latest News'), Filter::field('published')->title(function ($value) {
return $value ? 'Published' : 'Not Published';
}), Filter::custom('limit')->title(function ($value) {
return 'Custom Filter: ' . $value;
})->callback(function ($query, $value) {
$query->limit($value);
})]);
$display->columns([Column::string('title')->label('Title'), Column::datetime('date')->label('Date')->format('d.m.Y'), Column::custom()->label('Published')->callback(function ($instance) {
return $instance->published ? '✓' : '-';
})]);
return $display;
})->createAndEdit(function () {
$form = AdminForm::form();
$form->items([FormItem::text('title', 'Title')->required(), FormItem::date('date', 'Date')->required()->format('d.m.Y'), FormItem::checkbox('published', 'Published'), FormItem::ckeditor('text', 'Text')]);
return $form;
});
示例2: function
<?php
//dd(Storage::files('archivos-imprentas'));
Admin::model(\App\Orden::class)->title('Ordenes')->with()->filters(function () {
})->columns(function () {
Column::string('numero_de_orden', 'Numero de orden');
Column::date('valido_hasta', 'Valido Hasta')->format('medium', 'none');
Column::string('imprenta.nombre', 'Imprenta');
Column::Link('codigo', 'URL')->sortable(false);
Column::action('email', 'email')->icon('fa-envelope-o')->style('short')->callback(function ($instance) {
$imprenta = $instance->imprenta;
Mail::send('email', ['imprenta' => $imprenta, 'orden' => $instance], function ($m) use($instance, $imprenta) {
$m->from('muriell@petrilac.com.ar', 'Muriel Lodeiro');
$m->to($imprenta->email, $imprenta->contacto)->subject('Archivos disponibles para orden de compra: ' . $instance->numero_de_orden);
});
//return Redirect::route('my-route', [$instance->id]);
});
})->form(function () {
FormItem::text('numero_de_orden', 'Numero De Orden');
FormItem::select('imprenta_id', 'Imprenta')->list(App\Imprenta::class);
FormItem::date('valido_hasta', 'Valido Hasta');
FormItem::textarea('comentarios', 'Comentarios');
FormItem::archivosSelector('archivos_s', 'Archivos');
FormItem::archivosHidden('archivos', '');
});
示例3:
<?php
// Invoices
Admin::model('\\App\\Subscription')->title('Subscriptions')->as('subscriptions')->with('user')->with('invoice')->denyCreating(function () {
// Deny creating on thursday
return false;
})->denyEditingAndDeleting(function ($instance) {
// deny editing and deleting rows when this is true
return false;
})->filters(function () {
//ModelItem::filter('user_id')->name()->from('\User');
})->columns(function () {
// Describing columns for table view
Column::string('user.name', 'User');
Column::string('invoice.description', 'Invoice');
Column::date('start_date', 'Start Date');
Column::date('end_date', 'End Date');
Column::date('created_at', 'Created');
})->form(function () {
FormItem::select('user_id', 'Users')->list(\App\User::class);
FormItem::select('invoice_id', 'Invoices')->list(\App\Invoice::class);
FormItem::date('start_date', 'Start Date');
FormItem::date('end_date', 'End Date');
});
示例4:
<?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();
});
示例5: 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);
示例6: 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;
});
示例7:
<?php
Admin::model('App\\Events')->title('События')->display(function () {
$display = AdminDisplay::table();
$display->columns([Column::string('name')->label('Название'), Column::datetime('event_date')->label('Дата события'), Column::datetime('created_at')->label('Дата создания'), Column::datetime('updated_at')->label('Дата изменения')]);
return $display;
})->createAndEdit(function () {
$form = AdminForm::form();
$form->items([FormItem::columns()->columns([[FormItem::text('name', 'Название'), FormItem::date('event_date', 'Дата события')]]), FormItem::columns()->columns([[FormItem::textarea('desc', 'Описание для главной')], [FormItem::ckeditor('desc_full', 'Подробное описание')]]), FormItem::columns()->columns([[FormItem::images('images', 'Фотографии для главной')]])]);
return $form;
});
示例8: 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;
});
示例9:
<?php
Admin::model(\App\Holiday::class)->with('category')->title('Holiday')->columns(function () {
Column::string('title', 'Title');
Column::string('start', 'start');
Column::string('end', 'end');
Column::string('days', 'days');
Column::string('price', 'price');
Column::string('price', 'price');
Column::string('people_number', 'People Number');
})->form(function () {
///FormItem::select('category_id', 'Category')->model('Category')->display('title');
FormItem::select('category_id', 'Category')->list('App\\Category');
FormItem::text('title', 'Title');
FormItem::text('slug', 'slug');
FormItem::date('start', 'start');
FormItem::date('end', 'end');
FormItem::text('people_number', 'people_number');
FormItem::text('price', 'price');
FormItem::text('thumb', 'thumb');
FormItem::text('description', 'description');
FormItem::text('path_description', 'path_description');
FormItem::text('path_difficult', 'path_difficult');
FormItem::text('path_equipment', 'path_equipment');
FormItem::text('active', 'active');
});
示例10:
<?php
Admin::model(App\Document::class)->title('Document')->with()->filters(function () {
})->columns(function () {
Column::string('state', 'Status');
Column::string('description', 'Description');
Column::string('amount', 'Amount');
Column::date('due', 'Due On');
Column::string('ref_id', 'Ref. ID');
Column::string('ref_status', 'Ref. Status');
})->form(function () {
FormItem::text('state', 'Status');
FormItem::text('description', 'Description');
FormItem::text('amount', 'Amount');
FormItem::date('due', 'Due On');
FormItem::text('ref_id', 'Ref. ID');
FormItem::text('ref_status', 'Ref. Status');
});
示例11:
<?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');
});