コード例 #1
0
 public function create(array $data)
 {
     $avatars = MyFile::randomAvatar();
     $data['avatar_thumbnail'] = $avatars['avatar_thumbnail'];
     $data['avatar_standar'] = $avatars['avatar_standar'];
     return User::create(['first_name' => $data['first_name'], 'email' => $data['email'], 'password' => bcrypt($data['password']), 'postal_code' => $data['postal_code'], 'avatar_standar' => $data['avatar_standar'], 'avatar_thumbnail' => $data['avatar_thumbnail'], 'verified_code' => $data['verified_code'], 'raiting' => 0, 'bidicode' => str_random(15)]);
 }
コード例 #2
0
 /**
  * Handle a registration request for the application.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function postRegister(Request $request)
 {
     $validator = $this->validator($request->all());
     if ($validator->fails()) {
         return response()->json(['error' => ['message' => $validator->messages()]], 400);
     }
     $data = $request->all();
     $avatars = MyFile::randomAvatar();
     $data['avatar_thumbnail'] = $avatars['avatar_thumbnail'];
     $data['avatar_standar'] = $avatars['avatar_standar'];
     $data['verified_code'] = str_random(60);
     $user = $this->create($data);
     Auth::login($user);
     Mail::send('emails.verify', array('verified_code' => $data['verified_code']), function ($message) {
         $message->to(Input::get('email'))->subject($this->subjectVerified);
     });
     Session::put('register', 1);
     return response()->json(['success' => ['response' => $user]], 200);
 }