mercredi 15 novembre 2017

How to insert an array in MySQL table with Laravel ORM

I am trying to insert an entire api response into a MySQL table using Laravel Eloquent but I am getting 'Array to string conversion' error. How do I solve this?

Please note, it is compulsory that I save the entire API response.

My API call

$response = Curl::to($url.$request->account_number)
                    ->withData($data)
                    ->asJson(true)
                    ->get();

My Query

 TransactionLog::create([
                        'payer' => $request->payer,
                        'amount' => $request->amount,
                        'phone' => $request->phone,
                        'response' => $response

                    ]);



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2hwau9G
via IFTTT

Aucun commentaire:

Enregistrer un commentaire