Level 12
add this line to your model:
protected $incrementing = false;
1 like
Hi!
I have model with PK as string:
protected $primaryKey = "receipt";
protected $keyType = 'string';
in controller it's correctly saves to DB, but outputs JSON have "0" instead correct string:
$order = new Order;
$order->internal = $internal;
$order->receipt = $receiptString;
$order->save();
$output = array(
"data" =>$order,
);
return $this->asJson($output);
output is
{ "data": { "internal": "5e4408", "receipt": "0" } }
add this line to your model:
protected $incrementing = false;
Please or to participate in this conversation.