/** * @test **/ public function it_prepare_sentry_permission() { $data = ["permissions" => "permission1"]; $operation = 1; $helper = new FormHelper(); $helper->prepareSentryPermissionInput($data, $operation); $this->assertEquals(["permission1" => 1], $data["permissions"]); }
public function editPermission(Request $request) { // prepare input $input = $request->all(); $operation = $request->get('operation'); $this->form_model->prepareSentryPermissionInput($input, $operation); $id = $request->get('id'); try { $obj = $this->group_repository->update($id, $input); } catch (JacopoExceptionsInterface $e) { return Redirect::route("users.groups.edit")->withInput()->withErrors(new MessageBag(["permissions" => Config::get('acl_messages.flash.error.group_permission_not_found')])); } return Redirect::route('groups.edit', ["id" => $obj->id])->withMessage(Config::get('acl_messages.flash.success.group_permission_edit_success')); }
<?php use LaravelAcl\Authentication\Helpers\FormHelper; /** * permission select */ View::composer(['laravel-authentication-acl::admin.user.edit', 'laravel-authentication-acl::admin.group.edit'], function ($view) { $fh = new FormHelper(); $values_permission = $fh->getSelectValuesPermission(); $view->with('permission_values', $values_permission); }); /** * group select */ View::composer(['laravel-authentication-acl::admin.user.edit', 'laravel-authentication-acl::admin.group.edit', 'laravel-authentication-acl::admin.user.search'], function ($view) { $fh = new FormHelper(); $values_group = $fh->getSelectValuesGroups(); $view->with('group_values', $values_group); });