3 回答
TA贡献1827条经验 获得超7个赞
你可以像这样转换 MySQL 数据。
$profile = DB::table('app_user')->where([
'email' => $request->email,
'password' => md5($request->password),
'app_id' => $request->app_id
])->select(DB::raw('CAST(id AS varchar) as app_user_id, CAST(id as varchar) as id, name, email, user_image, activate'))
->first()
TA贡献1851条经验 获得超5个赞
使用mysql CAST函数转换为无符号整数
$profile = DB::table('app_user')->where([
'email' => $request->email,
'password' => md5($request->password),
'app_id' => $request->app_id
])->select(\DB::raw('CAST(id AS UNSIGNED) as app_user_id'),\DB::raw('CAST(id AS UNSIGNED) as id'),'name','email','user_image','activate')
->first();
TA贡献1876条经验 获得超7个赞
您可以在 mysql 查询中将整数转换为字符串,如下所示:
..
->selectRaw('CAST(id as CHAR(50)) as app_user_id', 'name', ...)
->first();
- 3 回答
- 0 关注
- 197 浏览
添加回答
举报