本文整理汇总了PHP中app\Permission::insert方法的典型用法代码示例。如果您正苦于以下问题:PHP Permission::insert方法的具体用法?PHP Permission::insert怎么用?PHP Permission::insert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Permission
的用法示例。
在下文中一共展示了Permission::insert方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: up
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
// Inserts the Permissions
Permission::insert($this->permissions);
// Creates a root admin role
$rootadmin = new Role();
$rootadmin->name = "rootadmin";
$rootadmin->display_name = "Root Admin";
$rootadmin->description = "Has Permissions to do everything in the WebPanel";
$rootadmin->save();
//Get all permissions
$ids = Permission::lists('id')->all();
//Sync them to the rootadmin
$rootadmin->perms()->sync($ids);
//Creates an admin user
$admin = new User();
$admin->name = 'admin';
$admin->email = 'admin@admin.com';
$admin->password = bcrypt('password');
$admin->save();
$admin->roles()->sync(array($rootadmin->id));
}
开发者ID:brucewu16899,项目名称:WebPanel-Core,代码行数:27,代码来源:2015_05_20_000000_webpanel_add_permissions_roles.php
示例2: store
public function store(PermissionRequest $request)
{
$dataForms = $request['data'];
if ($dataForms == null) {
return;
}
App\Permission::truncate();
$model = new App\Permission();
foreach ($dataForms as $dataForm) {
$dataSave[] = array('route' => $dataForm);
}
$model->insert($dataSave);
return redirect()->action('Admin\\PermissionController@index')->withSuccess(Lang::get('messages.update_success'));
}