예제 #1
0
파일: User.php 프로젝트: larabox/larabox
        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]);
        }
예제 #2
0
파일: Role.php 프로젝트: jetcms/jetcms
<?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;
});