/**
  * Store a newly created resource in storage.
  *
  * @param UserCreateRequest $request
  *
  * @return mixed
  */
 public function store(UserCreateRequest $request)
 {
     return $this->user->create($request->all());
 }
Esempio n. 2
0
 /**
  * Post add new user.
  * POST  /admin/add-user/{id}
  *
  * @param  UserInterface $userRepo,UserInterface $request
  *
  * @return view
  */
 public function postAddUser(UserCreateRequest $request, UserInterface $userRepo)
 {
     $data = $request->inputs();
     if ($data['profile_picture'] != "") {
         $path = public_path() . '/uploads/images/';
         $name = str_random();
         $logoFile = $request->file('profile_picture')->getClientOriginalExtension();
         $result = $request->file('profile_picture')->move($path, $name . '.' . $logoFile);
         $data['profile_picture'] = $name . '.' . $logoFile;
     }
     $userKey = rand(1111111111, 9999999999);
     $data['user_key'] = $userKey;
     $user = $userRepo->createOne($data);
     return redirect()->action('AdminController@getUsers');
 }