本文整理汇总了PHP中FormItem::password方法的典型用法代码示例。如果您正苦于以下问题:PHP FormItem::password方法的具体用法?PHP FormItem::password怎么用?PHP FormItem::password使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FormItem
的用法示例。
在下文中一共展示了FormItem::password方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
<?php
Admin::model('Cartalyst\\Sentinel\\Users\\EloquentUser')->title('Юзеры')->display(function () {
$display = AdminDisplay::datatables();
$display->with();
$display->filters([]);
$display->columns([Column::string('id')->label('Id'), Column::string('email')->label('Email'), Column::string('first_name')->label('Имя')]);
return $display;
})->create(function () {
$form = AdminForm::form();
$form->items([FormItem::columns()->columns([[FormItem::text('email', 'Email'), FormItem::password('password', 'Пароль'), FormItem::password('password_confirm', 'Подтверждение пароля')], [FormItem::text('first_name', 'Имя'), FormItem::text('last_name', 'Фамилия'), FormItem::view('admin.user_create')]])]);
return $form;
})->edit(function () {
$form = AdminForm::form();
$form->items([FormItem::columns()->columns([[FormItem::text('email', 'Email'), FormItem::password('password', 'Пароль'), FormItem::password('password_confirm', 'Подтверждение пароля')], [FormItem::text('first_name', 'Имя'), FormItem::text('last_name', 'Фамилия'), FormItem::view('admin.user_update')]])]);
return $form;
});
示例2: count
return $user_roles->count() > 0 ? $tooltip . $hidden_roles : '';
}), Column::custom()->label('Custom Permissions')->callback(function ($instance) {
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 {
示例3: function
case 'name':
return function () {
InlineEditItem::text('name', NULL)->validationRule('required|regex:/^[a-zA-Z0-9_@]{3,20}$/');
};
break;
default:
return function () {
};
break;
}
})->form(function () {
// Describing elements in create and editing forms
FormItem::text('username', 'Login')->validationRule('required|regex:/^[a-zA-Z0-9_@]{3,20}$/');
FormItem::text('name', 'Name')->validationRule('required|regex:/^[a-zA-Z0-9_\\s@]{3,20}$/');
$data = Input::all();
if (preg_match('/edit$/', Request::url()) || isset($data['_method']) && $data['_method'] == 'PUT') {
// ok this is update statement, so let's rock
FormItem::checkbox('changePassword', 'Change Password');
if (isset($data['changePassword']) && $data['changePassword'] == 1) {
FormItem::text('passwd', 'Password')->validationRule('required|regex:/^[a-zA-Z0-9_@]{6,20}$/');
FormItem::text('passwdConfirm', 'Password Confirmation')->validationRule('required|same:passwd');
} else {
FormItem::password('passwd', 'Password');
FormItem::password('passwdConfirm', 'Password Confirmation');
}
} else {
// this is create statement
FormItem::password('passwd', 'Password')->validationRule('required|regex:/^[a-zA-Z0-9_@]{6,20}$/');
FormItem::password('passwdConfirm', 'Password Confirmation')->validationRule('required|same:passwd');
}
});
示例4: config
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Input;
use App\Product;
use App\UserProduct;
Admin::model('App\\User')->title('Пользователи')->display(function () {
$display = AdminDisplay::datatables();
$display->columns([Column::checkbox(), Column::string('id')->label('ID'), Column::string('name')->label('Имя'), Column::custom()->label('Актив.')->callback(function ($instance) {
return $instance->is_active ? '✓' : '-';
}), Column::string('email')->label('Email'), Column::count('products')->label('Товаров')->orderable(true), Column::count('list_active_products')->label('Акт. товаров')->orderable(true), Column::string('balance')->label('Баланс')]);
$display->columnFilters([null, ColumnFilter::select()->model('App\\User')->display('name'), null, null, null, null]);
$display->actions([Column::action('export')->value('Раздать товары')->icon('fa-share')->callback(function ($collection) {
$max_products_per_user = config('main.max_products_per_user', 3);
foreach ($collection as $key => $user) {
$active_products = $user->list_active_products;
$count_active_products = count($active_products);
if ($count_active_products >= 0 && $count_active_products < $max_products_per_user) {
$random_product = Product::orderByRaw("RAND()")->first();
try {
$user_product = UserProduct::create(['user_id' => $user->id, 'product_id' => $random_product->id]);
} catch (QueryException $e) {
//Nothing
}
}
}
})]);
return $display;
})->createAndEdit(function () {
$form = AdminForm::form();
$form->items([FormItem::text('name', 'Name')->required(), FormItem::text('email', 'Email')->required()->unique(), FormItem::password('password', 'Пароль'), FormItem::checkbox('is_active', 'Активность')]);
return $form;
});
示例5:
<?php
/*
* This is a simple example of the main features.
* For full list see documentation.
*/
// Create admin model from User class with title and url alias
Admin::model(\App\User::class)->title('Users')->as('users-alias-name')->denyCreating(function () {
// Deny creating on thursday
//return date('w') == 4;
})->denyEditingAndDeleting(function ($instance) {
// deny editing and deleting rows when this is true
return $instance->email == 'admin';
})->columns(function () {
// Describing columns for table view
Column::string('name', 'Name');
Column::string('email', 'Email');
})->form(function () {
// Describing elements in create and editing forms
FormItem::text('name', 'Name');
FormItem::text('email', 'Email');
FormItem::password('password', 'Password');
});
示例6:
<?php
Admin::model(App\User::class)->title('Usuarios')->with()->filters(function () {
})->columns(function () {
Column::string('id', 'Id');
Column::string('name', 'Name');
Column::string('email', 'Email');
Column::string('razsoc', 'Razsoc');
Column::string('lista', 'Lista');
})->form(function () {
FormItem::text('name', 'Name');
FormItem::text('email', 'Email');
FormItem::password('password', 'Password (dejar vacía para no modificar)');
FormItem::text('razsoc', 'Razsoc');
FormItem::CustomLista();
FormItem::CustomRememberToken();
});