vendredi 8 novembre 2019

Property [sku] does not exist on this collection instance

Hi i am new to laravel and i tried to get the sku key result in the mentioned cURL query.However when i tried to print the $returnResult->sku it says sku does not exists.Can any one help?

enter image description here

public function search_by_id($name,$id){

         $returnResult = DB::table('glassfilms')
                        ->where('id' , '=' , $id)
                        ->get();

    //return $id;
                        //return $returnResult;

            $curl = curl_init();

                        curl_setopt_array($curl, array(
                            CURLOPT_URL => "http://localhost/amfrost_crm/help_pages/getProductAPI.php?products='$returnResult->sku'",
                            CURLOPT_RETURNTRANSFER => true,
                            CURLOPT_ENCODING => "",
                            CURLOPT_TIMEOUT => 30000,
                            CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
                            CURLOPT_CUSTOMREQUEST => "GET",
                            CURLOPT_HTTPHEADER => array(
                                // Set Here Your Requesred Headers
                                'Content-Type: application/json',
                            ),
                        ));
                        $response = curl_exec($curl);
                        $err = curl_error($curl);
                        curl_close($curl);

                        if ($err) {
                            echo "cURL Error #:" . $err;
                        } else {
                            return $response;
                        }


}


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire