Esempio n. 1
0
 /**
  * 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;
 }
Esempio n. 2
0
 /**
  * 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);
 }
Esempio n. 3
0
 /**
  * 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);
 }
Esempio n. 4
0
 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);
 }