Created
June 24, 2014 17:43
-
-
Save objectivehtml/475c45f6a8c9b63cc400 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$timeslots->select(DB::raw($select)) | |
->leftJoin(DB::raw('`profiles` as `host`'), 'timeslots.hostId', '=', 'host.id') | |
->where('host.deletedAt') | |
->where('start', '>=', Timeslot::date('Y-m-d 00:00:00', Timeslot::time($start))) | |
->where('start', '<=', Timeslot::date('Y-m-d 23:59:59', Timeslot::time($end))) | |
->where('clientId'); | |
$response = array(); | |
foreach($timeslots->get() as $index => $timeslot) | |
{ | |
$response[$index] = $timeslot->toArray(); | |
$settings = $response[$index]['hostSettings']; | |
unset($response[$index]['hostFirst']); | |
unset($response[$index]['hostLast']); | |
unset($response[$index]['hostEmail']); | |
unset($response[$index]['hostUid']); | |
unset($response[$index]['hostSettings']); | |
$response[$index]['host'] = (object) array( | |
'first' => $timeslot->hostFirst, | |
'last' => $timeslot->hostLast, | |
'email' => $timeslot->hostEmail, | |
'uid' => $timeslot->hostUid, | |
'settings' => $settings | |
); | |
} | |
return $this->success($response); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment