/** * Create role. * * @param string $roleName * * @return \Artesaos\Defender\Role */ protected function createRole($roleName) { // No need to check is_null($role) as create() throwsException $role = $this->roleRepository->create($roleName); $this->info('Role created successfully'); return $role; }
/** * Create a new role. * Uses a repository to actually create the role. * * @param string $roleName * * @return \Artesaos\Defender\Role */ public function createRole($roleName) { return $this->roleRepository->create($roleName); }
/** * Create a new role. * Uses a repository to actually create the role. * * @param string $roleName * @param string $readableName * @param string $type * * @return \Artesaos\Defender\Role */ public function createRole($roleName, $readableName = null, $type = 'business') { return $this->roleRepository->create($roleName, $readableName, $type); }
public function it_should_throw_an_exception_when_the_given_role_already_exists(RoleRepository $roleRepository) { $roleRepository->create('foo')->shouldBeCalled()->willThrow(new \Exception()); $this->shouldThrow('\\Exception')->duringCreateRole('foo'); }
/** * Create a new role * * @param Request $request * @return array */ public function store(Request $request) { $name = $request->get('name'); $newRole = $this->rolesRepository->create($name); return response()->json($newRole, 201); }