$comment = '-' . implode("\n-", $messages);
根据楼主的提示,成功的实现了自定义返回结果
{ "message": "success", "status_code": 200, "data": [ { "no": "88888888", "mobile": "13923458160", "id_no": "99999999", "name": "ColderWinter", "nick": "Wohoho", "sex": "男", "signature": "This is ColderWinter" } ] }
return $this->collection($users, new UserTransformer, [], function ($resource, $fractal) { $fractal->setSerializer(new CustomSerializer); });
==好