本文整理汇总了PHP中FormItem::roles方法的典型用法代码示例。如果您正苦于以下问题:PHP FormItem::roles方法的具体用法?PHP FormItem::roles怎么用?PHP FormItem::roles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FormItem
的用法示例。
在下文中一共展示了FormItem::roles方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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]);
}