public function borrowList(Request $request)
{
$user_id = JwtAuth::getInstance()->getUid();
$limit = $request->input('limit', 20);
$data_list = YunUserBorrowList::select(['status', 'created_at', 'borrow_no', 'allow_no'])
->where('user_id', $user_id)->where('data_from', 1);
$data = YunUserBorrow::where('user_id', $user_id)
->where('data_from', 1)
->select(['status', 'created_at', 'borrow_no', 'allow_no'])
->union($data_list)
->orderby('created_at', 'desc')
->paginate($limit)->toArray();
if (isset($data['data'])) {
foreach ($data['data'] as $key => $val) {
$data['data'][$key]['status'] = YunUserBorrow::status($val['status']);
}
}
return Helper::jsonSuccessData($data);
}