我已经填充了我的权限表来保存“pages.add”、“pages.edit”等值。在创建组时,我在复选框中填充了这些权限。在提交时,我遍历这些复选框的发布值并将它们放入一个数组中。然后我以这种方式创建组:
公共函数 store() { $validation = new CreateGroupValidator;
if ($validation->passes()) { try { // Create the group $permissions = Input::get('permissions'); $pers=array(); foreach($permissions as $p) { $pname=Permission::find($p)->name; array_add($pers,$pname,'1'); } $group = Sentry::createGroup(array( 'name' => Input::get('name'), 'permissions' => $pers )); return Redirect::route('admin.groups.index'); } catch (\Cartalyst\Sentry\Groups\GroupExistsException $e) { Notification::error('A group with same name already exists.'); } } return Redirect::back()->withInput()->withErrors($validation->errors); }
我看到值已填充到数组中。哨兵仍然不会在组表中加载这些权限。怎么了?请提出建议。