Skip to content

Instantly share code, notes, and snippets.

@objectivehtml
Created June 24, 2014 17:43
Show Gist options
  • Save objectivehtml/475c45f6a8c9b63cc400 to your computer and use it in GitHub Desktop.
Save objectivehtml/475c45f6a8c9b63cc400 to your computer and use it in GitHub Desktop.
$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