I wonder why after json_encode an array the value changes?
For example:
the value of dd($data['product']);
LengthAwarePaginator {#2707 ▼
#total: 8
#lastPage: 1
#items: Collection {#2676 ▼
#items: array:8 [▼
0 => ProductCatalog {#2485 ▼
+translatedAttributes: array:14 [▶]
#guarded: []
#searchableColumns: array:14 [▶]
#appends: array:1 [▶]
#connection: "mysql"
#table: "product_catalogs"
#primaryKey: "id"
#keyType: "int"
+incrementing: true
#with: []
#withCount: []
#perPage: 15
+exists: true
+wasRecentlyCreated: false
#attributes: array:48 [▼
"id" => 1565
"product_category_id" => 202
"master_data_nutrition_id" => null
"master_data_format_id" => 41
"is_archive" => 0
"created_at" => "2019-10-11 09:45:01"
"updated_at" => "2019-10-11 09:45:01"
"weight" => null
"refund" => 0
"max_refund" => null
"deleted_at" => null
"brand_id" => 20
"kode_product" => "9367011290038"
"kode_product_supplier" => "9367011290038"
"key_nutrition_specific_id" => null
"benefit_specific_id" => null
"how_to_consume" => null
"is_saleable" => 0
"is_stock_managed" => 0
"is_batch_managed" => 0
"kematangan" => "[]"
"flag_product" => "0"
"sold" => 0
"rating" => 0.0
"osa_score" => 0
"slug" => "roasted-organic-pistachio-unsalted-sesa"
"order_new" => null
"freshness" => 1236
"product_catalog_id" => 519
"locale" => "en"
"subtitle" => "xxx"
"name" => "Roasted Organic Pistachio Unsalted Sesa"
"warehouse" => null
"description" => """
Roasted Organic Pistachio Unsalted has undergone a unique dry roasting in our own factory with no salt addition. Pistachio has a savory taste like butter and de ▶
Caution:
Consumer with food or nut allergies, please read the ingredient statement carefully. Store in a cool and dry place.
"""
"nutrition_fact" => null
"word_of_coution" => null
"certification" => "null"
"packaging" => null
"product_name_bpom" => null
"ingredient" => null
"key_ingredient" => null
"key_nutrition_general" => null
"benefit_general" => null
"function_of_food" => null
"tagline" => "<p>Healthy Bone<br>Neutral Taste<br>Mixture For Any Dish</p>"
"rating_acessor" => "0,0"
"qty_acessor" => 0
"product_image_acessor" => "http://127.0.0.1:8000/img/cache/square-medium/default.png"
]
note: pay attention to name. It has a value in it.
Now, dd(json_encode($data['product']));
"{"current_page":1,"data":[{"id":1565,"product_category_id":202,"master_data_nutrition_id":null,"master_data_format_id":41,"is_archive":0,"created_at":"2019-10-11 09:45:01","updated_at":"2019-10-11 09:45:01","weight":null,"refund":0,"max_refund":null,"deleted_at":null,"brand_id":20,"kode_product":"9367011290038","kode_product_supplier":"9367011290038","key_nutrition_specific_id":null,"benefit_specific_id":null,"how_to_consume":null,"is_saleable":0,"is_stock_managed":0,"is_batch_managed":0,"kematangan":"[]","flag_product":"0","sold":0,"rating":0,"osa_score":0,"slug":"roasted-organic-pistachio-unsalted-sesa","order_new":null,"freshness":1236,"product_catalog_id":519,"locale":"en","subtitle":"xxx","name":null,"warehouse":null,"description":null,"nutrition_fact":null,"word_of_coution":null
Now, name equals null. This is strange. Any clue why?