I am storing some response from a third party. Sometimes data is not storing in to database. I checked the Laravel log and getting some error. I am using laravel 5.5 and mongo db.
Any help world be appreciated. Thanks.
Laravel log
[2018-09-10 11:40:50] production.ERROR: Detected invalid UTF-8 for fieldname "shipping_city": München
[2018-09-10 11:41:03] production.ERROR: Detected invalid UTF-8 for fieldname "_id": Ã$zjmêá¹ëmy×
[2018-09-10 11:48:16] production.ERROR: Method [error] does not exist on [App\Http\Controllers\PaymentController]. {"userId":"5b0d2b6f12236ca36a2282ed","exception":"[object] (BadMethodCallException(code: 0): Method [error] does not exist on [App\\Http\\Controllers\\PaymentController]. at /var/www/vhosts/cabin-holiday.frontend/vendor/laravel/framework/src/Illuminate/Routing/Controller.php:68)
PaymentController.php
$payment = new Payment;
foreach($_POST as $key => $value) {
if(Schema::hasColumn($payment->getTable(), $key)){
if(is_array($value)) {
$payment->{$key} = $value[1];
} else {
$payment->{$key} = $value;
}
}
}
$payment->save();