本文整理汇总了PHP中FormItem::ckeditor方法的典型用法代码示例。如果您正苦于以下问题:PHP FormItem::ckeditor方法的具体用法?PHP FormItem::ckeditor怎么用?PHP FormItem::ckeditor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FormItem
的用法示例。
在下文中一共展示了FormItem::ckeditor方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
<?php
/*
* This is a simple example of the main features.
* For full list see documentation.
*/
Admin::model('App\\Models\\License')->title('Licenses')->alias('license')->display(function () {
$display = AdminDisplay::datatablesAsync();
$display->order([[0, 'asc']]);
$display->columns([Column::string('name')->label('Name'), Column::string('duration')->label('Duration'), Column::custom()->label('Enabled')->callback(function ($instance) {
return $instance->is_enabled ? '✓' : '-';
}), Column::custom()->label('Payed version')->callback(function ($instance) {
return $instance->needs_validation ? '✓' : '-';
}), Column::datetime('created_at')->format('d-m-Y h:i:s')->label('Created'), Column::datetime('updated_at')->format('d-m-Y h:i:s')->label('Updated')]);
$display->columnFilters([ColumnFilter::text()->placeholder('Name'), null, null, null, ColumnFilter::range()->from(ColumnFilter::date()->format('d.m.Y')->placeholder('From Date'))->to(ColumnFilter::date()->format('d.m.Y')->placeholder('To Date')), ColumnFilter::range()->from(ColumnFilter::date()->format('d.m.Y')->placeholder('From Date'))->to(ColumnFilter::date()->format('d.m.Y')->placeholder('To Date'))]);
return $display;
})->edit(function () {
$form = AdminForm::form();
$form->items([FormItem::custom()->display(function ($instance) {
return '<div class="form-group ">
<label for="key">Key</label><br/>
' . $instance->key . '
</div>';
}), FormItem::text('name', 'Name')->required(), FormItem::text('duration', 'Duration')->required(), FormItem::checkbox('is_enabled', 'Enabled'), FormItem::checkbox('needs_validation', 'Payed version'), FormItem::ckeditor('description', 'Description')]);
return $form;
})->create(function () {
$form = AdminForm::form();
$form->items([FormItem::text('name', 'Name')->required(), FormItem::text('duration', 'Duration')->required(), FormItem::checkbox('is_enabled', 'Enabled'), FormItem::checkbox('needs_validation', 'Payed version'), FormItem::ckeditor('description', 'Description')]);
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\\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;
});
示例4:
<?php
Admin::model('App\\Page')->title('Pages')->display(function () {
$display = AdminDisplay::tree();
$display->value('title');
return $display;
})->createAndEdit(function () {
$form = AdminForm::form();
$form->items([FormItem::text('title', 'Title'), FormItem::ckeditor('text', 'Text')]);
return $form;
});
示例5:
<?php
// Pages
Admin::model('\\App\\Page')->title('Pages')->as('pages')->denyCreating(function () {
// Deny creating on thursday
return false;
})->denyEditingAndDeleting(function ($instance) {
// deny editing and deleting rows when this is true
return false;
})->columns(function () {
// Describing columns for table view
Column::string('title', 'Title');
Column::date('created_at', 'Created');
})->form(function () {
// Describing elements in create and editing forms
FormItem::text('title', 'Title');
FormItem::ckeditor('content', 'Content');
});
示例6:
<?php
Admin::model('Dimonpvt\\Productso\\Models\\PrsoCategory')->title('Категории товаров')->display(function () {
$display = AdminDisplay::tree();
$display->value('name');
return $display;
})->createAndEdit(function () {
$form = AdminForm::form();
$form->items([FormItem::text('name', 'Название'), FormItem::text('slug', 'Ярлык'), FormItem::checkbox('showtop', 'Главное меню')->defaultValue(true), FormItem::checkbox('showside', 'Боковое меню')->defaultValue(true), FormItem::checkbox('showbottom', 'Меню подвала')->defaultValue(true), FormItem::checkbox('showcontent', 'В спсике категорий')->defaultValue(true), FormItem::ckeditor('note', 'Аннотация'), FormItem::ckeditor('desc', 'Описание'), Formitem::multiimages('photos', 'Фотки')]);
return $form;
});
示例7:
<?php
Admin::model(App\Models\User_Progress::class)->title('')->with()->filters(function () {
})->columns(function () {
})->form(function () {
FormItem::checkbox('progress_id', 'Progress');
FormItem::checkbox('user_id', 'User');
FormItem::checkbox('experience', 'Experience');
FormItem::checkbox('gift', 'Gift');
FormItem::ckeditor('description', 'Description');
});
示例8:
<?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);
});
示例9:
<?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;
});
示例10:
<?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;
});
示例11:
<?php
/*
* Создание и редактирование статей.
* Файл Post.php
*/
Admin::model('App\\Models\\Post')->title('Article')->filters(function () {
ModelItem::filter('PostForId')->scope('PostForId')->title('От 3 до 5');
})->columns(function () {
Column::string('link', 'Link');
Column::string('header', 'Header');
Column::string('article', 'Article');
Column::string('author', 'Author');
Column::string('created_at', 'Created_at');
Column::string('updated_at', 'Updated_at');
})->form(function () {
FormItem::text('link', 'Link')->required();
FormItem::text('header', 'Header')->required();
FormItem::ckeditor('article', 'Article')->required();
FormItem::text('author', 'Author')->required();
FormItem::timestamp('created_at', 'Created_at')->required();
FormItem::timestamp('updated_at', 'Updated_at')->required();
});
示例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:
<?php
Admin::model('App\\Gallery')->title('Galerias')->display(function () {
$display = AdminDisplay::datatables();
$display->with();
$display->filters([]);
$display->columns([Column::string('title')->label('Title'), Column::string('tag')->label('Tag')]);
return $display;
})->createAndEdit(function () {
$form = AdminForm::form();
$form->items([FormItem::text('title', 'Title'), FormItem::text('subtitle', 'Subtitle'), FormItem::text('tag', 'Tag'), FormItem::ckeditor('description', 'Description'), FormItem::galleryList('images', 'Imagenes'), FormItem::textList('videos', 'Videos')]);
return $form;
});