コード例 #1
0
 /**
  * View role
  * @param  int $id
  * @return Response
  */
 public function show($id)
 {
     // get role by id
     $role = Role::find($id);
     if (!$role) {
         return response()->json(null, 404);
     }
     return response()->json(arrayView('phpsoft.users::role/read', ['role' => $role]), 200);
 }
コード例 #2
0
 public function testPermissionUserIsAdmin()
 {
     // Check user is admin
     $user = factory(App\User::class)->create();
     $login = Auth::login($user);
     $admin = Role::find(1);
     // Attach admin role for user
     $user->attachRole($admin);
     $controller = new Controller();
     $isAdmin = $controller->checkPermission('manage-user');
     $this->assertEquals(true, $isAdmin);
 }
コード例 #3
0
 public function testDeleteSuccess()
 {
     $role = factory(Role::class)->create();
     $res = $this->call('DELETE', '/roles/' . $role->id);
     $this->assertEquals(204, $res->getStatusCode());
     $exists = Role::find($role->id);
     $this->assertNull($exists);
 }