【发布时间】:2020-11-23 10:56:23
【问题描述】:
我在 Ubuntu 服务器上有我的 Laravel Lumen 应用程序,我更改了服务器时区,我的应用程序使用正确的时区成功保存了 created_at、update_at,现在当我获取一些表数据时,我注意到结果时间不是与数据库中的相同。
例如:
-
数据库中的created_at =
2020-08-03 13:52:35 -
查询结果中的created_at =
2020-08-03 10:52:35
根据要求更新,以下是我的查询
public function Outbox($id){
$orders = DB::table('order_details as o')
->join('user_profile as a','o.reciever_id','=','a.id')
->join('regions as r','a.province','=','r.province')
->where('o.sender_id' ,'=', $id)
->select('a.bid','r.ar_name as province','o.order_bar','o.price','o.delivery_cost','o.description','o.type','o.dropoff_time as time','o.status','o.visual_status','o.created_at')
->orderBy('o.created_at','desc')
->get();
if(count($orders) > 0){
return response()->json(['status_code'=>1000,'data'=>$orders , 'message'=>null],200);
}else{
return response()->json(['status_code'=>2000,'data'=>null , 'message'=>null],200);
}
}
这里有什么问题??
任何帮助将不胜感激
【问题讨论】:
-
检查“
/config/app.php”中服务器和laravel应用程序的时区 -
Lumen 没有配置文件