以下のようにLaravel 4に参加しました:
return DB::table(Location::getTableName() . ' as l')->where('l.company_id', $companyId)
->join(User::getTableName() . ' as u', 'u.location_id', '=', 'l.id')->whereIn('l.id', $locationsId)
->join(UserTimeline::getTableName() . ' as ut', 'ut.user_id', '=', 'u.id')
->join(Status::getTableName() . ' as s', 's.id', '=', 'ut.status_id')
->select(
'l.name as location_name',
'u.first_name as user_first_name',
'u.last_name as user_last_name',
'u.email as user_email',
'ut.started_at as timeline_started_at',
'ut.finished_at as timeline_finished_at',
's.id as status_id',
's.label as status_label'
)
->orderBy('ut.id', 'asc')
->skip($from)
->limit($limit)
->get();
ユーザーのタイムゾーンを検出し、GMT との差を数値として計算する必要があります。パキスタンでは +5、インドでは +5.5 です。今私の問題は、この結合のデータを CSV ファイルにエクスポートしていることです。「timeline_started_at」と「timeline_finished_at」に時間を数値として追加する必要があります。検索したところ、SQL の 'DATEADD' メソッドで時間を加算または減算できることがわかりました。
本当の問題は、上記の結合のどこで Laravel の結合で「DATEADD」関数を使用する必要があるのか わからないことです。
誰かがこの点で私を助けてくれますか?????????