app/Http/Controllers/Auth/AuthController.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)
    {
        $token=str_random(40);
        $client = new \GuzzleHttp\Client();
        $response = $client->post( env('DP_BASE_URL')."/api", [
            'headers' => [
                'api-key' => env('API_KEY')],
            'form_params' => [
                'api_token'=>$token,
            ]
        ]
        );
        return User::create([
            'name' => $data['name'],
            'email' => $data['email'],
            'password' => bcrypt($data['password']),
            'api_token'=> $token,
        ]);
    }
protected function create ( array $ data ) { $ token = str_random ( 40 ) ; $ client = new \ GuzzleHttp \ Client ( ) ; $ response = $ client -> post ( env ( 'DP_BASE_URL' ) . " /api " , [ 'headers' => [ 'api-key' => env ( 'API_KEY' ) ] , 'form_params' => [ 'api_token' => $ token , ] ] ) ; return User :: create ( [ 'name' => $ data [ 'name' ] , 'email' => $ data [ 'email' ] , 'password' => bcrypt ( $ data [ 'password' ] ) , 'api_token' => $ token , ] ) ; }
Create a new user instance after a valid registration.
Create a new user instance after a valid registration .
// un array con la data de los headers como tipo de peticion, etc. // array de datos del formulario