app/Http/Controllers/Api/UserController.php
/**
     * Create a new user instance after a valid registration.
     *
     * @param  array  $data
     * @return User
     */
Create a new user instance after a valid registration.
@param  array  $data
@return User
Create a new user instance after a valid registration . @param array $data @return User
protected function create(array $data)
    {
        \DB::beginTransaction();
        $user = User::create([
            'name'         => $data['name'],
            'email'        => $data['email'],
            'password'     => bcrypt($data['password']),
            'socket_token' => str_random(60),
            'api_token'    => str_random(60),
            'last_online'  => date('Y-m-d H:i:s'),
        ]);
        $profileData = $this->getProfileData($data);
        $profileData['user_id'] = $user->id;
        $profile = UserProfile::create($profileData);
        $user->addProfilePicture($data['image']);
        \DB::commit();
        return $user;
    }
protected function create ( array $ data ) { \ DB :: beginTransaction ( ) ; $ user = User :: create ( [ 'name' => $ data [ 'name' ] , 'email' => $ data [ 'email' ] , 'password' => bcrypt ( $ data [ 'password' ] ) , 'socket_token' => str_random ( 60 ) , 'api_token' => str_random ( 60 ) , 'last_online' => date ( 'Y-m-d H:i:s' ) , ] ) ; $ profileData = $ this -> getProfileData ( $ data ) ; $ profileData [ 'user_id' ] = $ user -> id ; $ profile = UserProfile :: create ( $ profileData ) ; $ user -> addProfilePicture ( $ data [ 'image' ] ) ; \ DB :: commit ( ) ; return $ user ; }
Create a new user instance after a valid registration.
Create a new user instance after a valid registration .