本文整理汇总了PHP中Column::order方法的典型用法代码示例。如果您正苦于以下问题:PHP Column::order方法的具体用法?PHP Column::order怎么用?PHP Column::order使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Column
的用法示例。
在下文中一共展示了Column::order方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
<?php
\Admin::model('App\\LandingBlocks')->title('Landing blocks')->alias('landing-blocks')->display(function () {
$display = AdminDisplay::table();
$display->apply(function ($query) {
$query->orderBy('order', 'ASC');
});
$display->columns([Column::checkbox(), Column::string('id')->label('#'), Column::string('label')->label('Загаловок'), Column::order()]);
return $display;
})->edit(function ($id) {
$form = AdminForm::tabbed();
$fields = [];
$fields['Main'] = [FormItem::columns()->columns([[FormItem::text('label', 'Загаловок')->required()->unique(), FormItem::textarea('description', 'Описание'), FormItem::text('class', 'Класс'), FormItem::icheckbox('active', 'Статус')->defaultValue(true)], [FormItem::text('name', 'Имя блока')->required(), FormItem::text('landing_id', 'Landing')]])];
$model = App\LandingBlocks::find($id);
if ($model) {
$path = base_path('App' . DIRECTORY_SEPARATOR . 'AdminLanding' . DIRECTORY_SEPARATOR . str_replace('.', DIRECTORY_SEPARATOR, $model->name) . '.php');
if (is_file($path)) {
$fields2 = (require_once $path);
$fields = array_merge($fields, $fields2);
}
}
$form->items($fields);
return $form;
})->create(function ($id) {
$form = AdminForm::tabbed();
$fields = [];
$fields['Main'] = [FormItem::columns()->columns([[FormItem::text('label', 'Загаловок')->required()->unique(), FormItem::textarea('description', 'Описание')->required(), FormItem::text('class', 'Класс'), FormItem::icheckbox('active', 'Статус')->defaultValue(true)], [FormItem::text('name', 'Имя блока')->required(), FormItem::text('landing_id', 'Landing')]])];
$form->items($fields);
return $form;
});
示例2: use
<?php
/** @var \SleepingOwl\Admin\Model\ModelConfiguration $model */
$model = Admin::model(\App\HistoryDate::class);
$model->title('История – даты');
$model->display(function () {
$display = AdminDisplay::datatables();
$display->columns([Column::checkbox(), Column::string('title')->label('Заголовок')->orderable(false), Column::string('description')->label('Описание')->orderable(false), Column::count('events')->label('Событий')->orderable(false), Column::datetime('created_at')->label('Создан')->format('d.m.Y в H:i')->orderable(false), Column::order()->orderable(false)]);
$display->order([[5, 'asc']]);
$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', 'Заголовок')->required(), FormItem::text('description', 'Описание')]);
return $form;
});
示例3:
<?php
Admin::model('App\\Country')->title('Countries (orderable)')->display(function () {
$display = AdminDisplay::table();
$display->apply(function ($query) {
$query->orderBy('order', 'asc');
});
$display->columns([Column::string('title')->label('Title'), Column::count('contacts')->label('Contacts')->append(Column::filter('country_id')->model('App\\Contact')), Column::order()]);
return $display;
})->createAndEdit(function () {
$form = AdminForm::form();
$form->items([FormItem::text('title', 'Title')->required()->unique()]);
return $form;
});
示例4: use
<?php
/** @var \SleepingOwl\Admin\Model\ModelConfiguration $mdenu */
$model = Admin::model(\App\ScheduleAndCost::class);
$model->title('Блок расписание и стоимость');
$model->display(function () {
$display = AdminDisplay::datatables();
$display->columns([Column::string('title')->label('Заголовок')->orderable(false), Column::datetime('created_at')->label('Создан')->orderable(false), Column::order()->orderable(false)]);
$display->apply(function (\Illuminate\Database\Eloquent\Builder $query) {
$query->withTrashed();
$query->orderBy('order', 'asc');
});
return $display;
})->createAndEdit(function ($id) use($model) {
$model->title($id ? 'Редактировать блок' : 'Создать блок');
$form = AdminForm::form();
$form->items([FormItem::text('title'), FormItem::ckeditor('text')]);
return $form;
});
示例5: use
<?php
/**
* @var \SleepingOwl\Admin\Model\ModelConfiguration
*/
$model = Admin::model(\App\Slide::class);
$model->title('Слайды');
$model->display(function () {
$display = AdminDisplay::datatables();
$display->with('page');
$display->columns([Column::image('image')->label('Картинка')->orderable(false), Column::string('title')->label('Заголовок')->orderable(false), Column::string('description')->label('Описание')->orderable(false), Column::string('page.title')->label('Страница')->append(Column::filter('id')->model(\App\Page::class)->field('page_id'))->orderable(false), Column::order()->orderable(false)]);
$display->apply(function ($query) {
$query->orderBy('sort', 'asc');
});
return $display;
});
$model->createAndEdit(function ($id) use($model) {
$model->title($id ? 'Редактировать слайд' : 'Создать слайд');
$form = AdminForm::form();
$form->items([FormItem::columns()->columns([[FormItem::text('title', 'Заголовок')->required(), FormItem::select('page_id', 'Страница')->model(\App\Page::class)->display('title')->required(), FormItem::textarea('description', 'Описание')->rows(4)], [FormItem::image('image', 'Картинка')->required(true)]])]);
return $form;
});
示例6:
<?php
Admin::model('App\\Category')->title('Categorias')->display(function () {
$display = AdminDisplay::table();
$display->apply(function ($query) {
$query->orderBy('order', 'asc');
});
$display->columns([Column::string('name')->label('Nombre'), Column::count('products')->label('Productos'), Column::order()]);
return $display;
})->createAndEdit(function () {
$form = AdminForm::form();
$form->items([FormItem::text('name', 'Nombre'), FormItem::image('banner', 'Banner'), FormItem::ckeditor('description', 'Descripcion')]);
return $form;
});