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


PHP FormItem::permissions方法代码示例

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


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

示例1: count

        return count($instance->permissions) > 0 ? 'Yes' : 'No';
    })]);
    return $display;
})->createAndEdit(function ($id) {
    $form = AdminForm::tabbed();
    /**
     * Fix
     */
    if (is_null($id)) {
        $form->storable(false);
        $form->event_handler('SleepingOwl\\Admin\\Events\\UserEvent');
        $password = FormItem::password('password', 'Password')->sentinel()->required();
    } else {
        $password = FormItem::password('password', 'Password')->sentinel();
    }
    $form->items(['Details' => [FormItem::text('first_name', 'Firstname')->required(), FormItem::text('last_name', 'Lastname')->required(), FormItem::text('email', 'Email')->required()->unique(), FormItem::sentinelpassword('password', 'Password'), FormItem::image('avatar', 'Avatar')], 'Roles & Permissions' => [FormItem::roles('roles', 'Roles')->model('Cartalyst\\Sentinel\\Roles\\EloquentRole')->display('name'), FormItem::permissions('permissions', 'Permissions')->inherited()], 'User Settings' => [FormItem::custom()->display(function ($instance) {
        $skins = ['blue' => 'Blue', 'blue-light' => 'Blue Light', 'black' => 'Black', 'black-light' => 'Black Light', 'purple' => 'Purple', 'purple-light' => 'Purple Light', 'green' => 'Green', 'green-light' => 'Green Light', 'red' => 'Red', 'red-light' => 'Red Light', 'yellow' => 'Yellow', 'yellow-light' => 'Yellow Light'];
        $field_params = ['name' => 'theme.skin', 'lang' => null, 'label_size' => null, 'field_size' => null, 'label' => 'Theme Skin', 'required_field' => false, 'multi' => false, 'plugin' => null, 'nullable' => false, 'options' => $skins, 'value' => \SoaUserSetting::get('theme.skin', config('admintheme.skin'), $instance->id), 'help_text' => null];
        return view(AdminTemplate::view('formitem.select'), $field_params)->render();
    })->callback(function ($instance) {
        \SoaUserSetting::set('theme.skin', \Request::input('theme_skin'), $instance->id);
        \SoaUserSetting::save();
    }), FormItem::custom()->display(function ($instance) {
        $field_params = ['name' => 'theme.fixed_layout', 'lang' => null, 'label_size' => null, 'field_size' => null, 'label' => 'Fixed Layout', 'required_field' => false, 'value' => \SoaUserSetting::get('theme.fixed_layout', config('admintheme.fixed_layout'), $instance->id), 'help_text' => 'You can\'t use fixed and boxed layouts together.'];
        return view(AdminTemplate::view('formitem.checkbox'), $field_params)->render();
    })->callback(function ($instance) {
        if (!\Request::has('theme_fixed_layout')) {
            \Request::merge(['theme_fixed_layout' => false]);
        } else {
            \Request::merge(['theme_fixed_layout' => true]);
        }
开发者ID:larabox,项目名称:larabox,代码行数:31,代码来源:User.php

示例2:

<?php

\Admin::model('Cartalyst\\Sentinel\\Roles\\EloquentRole')->title('Roles')->alias('roles')->display(function () {
    $display = AdminDisplay::table();
    $display->columns([Column::checkbox(), Column::string('id')->label('#'), Column::string('name')->label('Name'), Column::string('slug')->label('Slug')]);
    return $display;
})->createAndEdit(function () {
    $form = AdminForm::tabbed();
    $form->items(['Details' => [FormItem::text('name', 'Name')->required(), FormItem::text('slug', 'Slug')->required()->unique()], 'Permissions' => [FormItem::permissions('permissions', 'Permissions')]]);
    return $form;
});
开发者ID:jetcms,项目名称:jetcms,代码行数:11,代码来源:Role.php


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