当前位置: 首页>>代码示例>>PHP>>正文


PHP AdminDisplay类代码示例

本文整理汇总了PHP中AdminDisplay的典型用法代码示例。如果您正苦于以下问题:PHP AdminDisplay类的具体用法?PHP AdminDisplay怎么用?PHP AdminDisplay使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了AdminDisplay类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1:

<?php

Admin::model('App\\Marker')->title('Маркеры')->display(function () {
    $display = AdminDisplay::datatables();
    $display->with('markerGroups');
    $display->filters([]);
    $display->columns([Column::string('name')->label('Имя'), Column::lists('markerGroups.name')->label('Входит в группы'), Column::image('ico')->label('Иконка')]);
    return $display;
})->create(function () {
    $form = AdminForm::form();
    $form->items([FormItem::columns()->columns([[FormItem::text('name', 'Имя'), FormItem::image('ico', 'Иконка'), FormItem::checkbox('showadd', 'Показывать в форме добавления рецепта')->defaultValue(0), FormItem::text('sortorder', 'Порядок сортировки')], [FormItem::text('metakey', 'Meta Keywords'), FormItem::text('metadesk', 'Meta Description'), FormItem::text('slug', 'Slug (если пустое, генерируется реалтайм из имени)'), FormItem::text('title', 'Title')]])]);
    return $form;
})->edit(function () {
    $form = AdminForm::form();
    $form->items([FormItem::columns()->columns([[FormItem::text('name', 'Имя'), FormItem::image('ico', 'Иконка'), FormItem::checkbox('showadd', 'Показывать в форме добавления рецепта'), FormItem::text('sortorder', 'Порядок сортировки')], [FormItem::text('metakey', 'Meta Keywords'), FormItem::text('metadesk', 'Meta Description'), FormItem::text('slug', 'Slug (если пустое, генерируется реалтайм из имени)'), FormItem::text('title', 'Title')]])]);
    return $form;
});
开发者ID:AngryGantz,项目名称:cms-cookbook,代码行数:17,代码来源:Marker.php

示例2:

<?php

\Admin::model('App\\Product')->title('Products')->alias('products')->display(function () {
    $display = AdminDisplay::datatablesAsync();
    $display->columns([Column::checkbox(), Column::string('id')->label('#'), Column::string('title')->label('Загаловок'), Column::string('active_status')->label('Статус'), Column::string('publish')->label('Опубликован')]);
    return $display;
})->createAndEdit(function () {
    $form = AdminForm::tabbed();
    $form->items(['Main' => [FormItem::columns()->columns([[FormItem::text('title', 'Загаловок')->required()->unique(), FormItem::textarea('description', 'Описание')->required(), FormItem::timestamp('publish', 'Дата и время публикации')->defaultValue(Carbon\Carbon::now()), FormItem::icheckbox('active', 'Статус')->defaultValue(true), FormItem::text('rest', 'Остаток'), FormItem::text('price', 'Цена')], [FormItem::text('sort', 'сортировка'), FormItem::bsselect('user_id', 'Пользователь')->model('App\\User')->defaultValue(Sentinel::check()->id)->display('email'), FormItem::bsselect('catalog_id', 'Категоря')->model('App\\Catalog')->display('level_label')->disableSort()->required()]])], 'content' => [FormItem::markdown('content', 'Контент')], 'images' => [FormItem::images('gallery', 'Картинки')], 'files' => [FormItem::view('suroviy.soa_addon::admin.elfinder')]]);
    return $form;
});
开发者ID:larabox,项目名称:larabox,代码行数:11,代码来源:Product.php

示例3:

<?php

Admin::model('App\\About')->title('About')->display(function () {
    $display = AdminDisplay::table();
    $display->columns([Column::string('description')->label('description')]);
    return $display;
})->createAndEdit(function () {
    $form = AdminForm::form();
    $form->items([FormItem::ckeditor('description', 'Description')->required()]);
    return $form;
});
开发者ID:svvpro,项目名称:artem_project,代码行数:11,代码来源:About.php

示例4: strlen

    $display = AdminDisplay::tabbed();
    $display->tabs(function () {
        $tabs = [];
        $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 ? '&check;' : '-';
        })];
        $main = AdminDisplay::table();
        $main->columns($columns);
        $tabs[] = AdminDisplay::tab($main)->label('Main')->active(true);
        $withScope = AdminDisplay::table();
        $withScope->scope('last');
        $withScope->columns($columns);
        $tabs[] = AdminDisplay::tab($withScope)->label('With Scope');
        $otherColumns = AdminDisplay::table();
        $otherColumns->apply(function ($query) {
            $query->orderBy('title', 'asc');
        });
        $otherColumns->columns([Column::string('title')->label('Title'), Column::custom()->label('Title Length')->callback(function ($instance) {
            return strlen($instance->title);
        })]);
        $tabs[] = AdminDisplay::tab($otherColumns)->label('Other Columns and Order');
        $otherDisplay = Admin::model('App\\Page')->display();
        $tabs[] = AdminDisplay::tab($otherDisplay)->label('Display from Other Model');
        return $tabs;
    });
    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;
});
开发者ID:ntamvl,项目名称:admin-3-demo,代码行数:31,代码来源:News3.php

示例5:

<?php

\Admin::model('App\\Category')->title('Category')->alias('category')->display(function () {
    $display = AdminDisplay::tree();
    $display->value('label|name');
    return $display;
})->createAndEdit(function () {
    $form = AdminForm::tabbed();
    $form->items(['Main' => [FormItem::columns()->columns([[FormItem::text('label', 'Загаловок')->required()->unique(), FormItem::text('name', 'Название')->required()->unique(), FormItem::textarea('description', 'Описание'), FormItem::icheckbox('active_status', 'Статус')->defaultValue(true)], [FormItem::image('image', 'Картинка')]])], 'content' => [FormItem::markdown('content', 'Содержимое')]]);
    return $form;
});
开发者ID:larabox,项目名称:larabox,代码行数:11,代码来源:Category.php

示例6: str_limit

        $secondaryDisplay = AdminDisplay::datatables();
        $secondaryDisplay->apply(function ($query) {
            $query->onlyTrashed();
        });
        $secondaryDisplay->columns([Column::checkbox(), Column::string('id'), Column::custom()->label('Картинка')->callback(function ($instance) {
            $attachment = $instance->attachments()->first();
            if (!is_null($attachment)) {
                if ($attachment->type === 'album') {
                    $attachment = $attachment->childs()->first();
                }
                return "<img class='thumbnail' width='80px' src='{$attachment->srcs['image_small']}'>";
            }
            return '';
        }), Column::custom()->label('Текст')->callback(function ($instance) {
            return str_limit($instance->text, 180);
        }), Column::datetime('date')->label('Создан')->format('d.m.Y в H:i'), Column::datetime('created_at')->label('Импортирован')->format('d.m.Y в H:i'), Column::datetime('deleted_at')->label('Удален')->format('d.m.Y в H:i')]);
        $secondaryDisplay->actions([Column::action('post_restore')->value('Восстановить записи')->icon('fa-refresh')->callback(function (\Illuminate\Database\Eloquent\Collection $collections) {
            if ($collections) {
                /** @var \App\Post $collection */
                foreach ($collections as $collection) {
                    $collection->restore();
                }
            }
        })]);
        $tabs = [];
        $tabs[] = AdminDisplay::tab($mainDisplay)->label('Активные записи')->active(true);
        $tabs[] = AdminDisplay::tab($secondaryDisplay)->label('Удаленные записи');
        return $tabs;
    });
    return $display;
});
开发者ID:stcoder,项目名称:uf-vova,代码行数:31,代码来源:Post.php

示例7: 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);
开发者ID:ntamvl,项目名称:admin-3-demo,代码行数:30,代码来源:Contact3.php

示例8:

<?php

Admin::model('App\\Post')->title('Posts (soft deletes)')->display(function () {
    $display = AdminDisplay::tabbed();
    $display->tabs(function () {
        $tabs = [];
        $default = AdminDisplay::table();
        $default->columns([Column::string('title')->label('Title')]);
        $tabs[] = AdminDisplay::tab($default)->label('Default')->active(true);
        $withTrashed = AdminDisplay::table();
        $withTrashed->scope('withTrashed');
        $withTrashed->columns([Column::string('title')->label('Title')]);
        $tabs[] = AdminDisplay::tab($withTrashed)->label('With Trashed');
        $onlyTrashed = AdminDisplay::table();
        $onlyTrashed->scope('onlyTrashed');
        $onlyTrashed->columns([Column::string('title')->label('Title')]);
        $tabs[] = AdminDisplay::tab($onlyTrashed)->label('Only Trashed');
        return $tabs;
    });
    return $display;
})->createAndEdit(function () {
    $form = AdminForm::form();
    $form->items([FormItem::text('title', 'Title')->required()->unique(), FormItem::ckeditor('text', 'Text')]);
    return $form;
});
开发者ID:ntamvl,项目名称:admin-3-demo,代码行数:25,代码来源:Post.php


注:本文中的AdminDisplay类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。