/**
  * Store a newly created resource in storage.
  *
  * @param  CreateRequest  $request
  * @return Response
  */
 public function store(CreateRequest $request)
 {
     $userId = $this->userRepository->store($request->all());
     if ($userId && ($roles = $request->input('roles', []))) {
         $this->userRepository->attachRole($userId, $roles);
     }
     $alert = $userId ? '新用户创建成功' : '用户创建失败';
     return redirect('rbac/user')->with('message', $alert);
 }
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(CreateRequest $createRequest)
 {
     $userId = $this->userRepository->store($createRequest->all());
     if ($userId && ($roles = $createRequest->input('roles', []))) {
         $this->userRepository->attachRole($userId, $roles);
     }
     $alert = ['type' => $userId ? 'success' : 'warning', 'data' => $userId ? ['新用户创建成功'] : ['用户创建失败']];
     return redirect('admin/rbac/user/create')->with('am-alert', $alert);
 }