Can't json_encode() an array or Laravel collection: “Type is not supported”

感情迁移 提交于 2020-06-23 08:18:34
问题 I don't know what I'm doing wrong since it works with all the other models in the app. I refreshed and reseeded the database multiple times. The models extend the same abstract methods. This is the code in the controller: $substrates = $this->substrates->all()->toArray(); $temp = json_encode(