hi all,
i need to execute the following query as iam new to laravel, i cant find what went wrong in this statement
$union = DB::table('activity_stream')->select();
foreach ($responses as $response) {
$select = DB::table('activity_stream')->select('activity_stream.action_id')
->join('activity_actions', 'activity_actions.action_id', '=', 'activity_stream.action_id')
->where('activity_stream.target_type', $response['type'])
->where('activity_stream.is_active', '0');
if (empty($response['data'])) {
$select->where('activity_stream.target_id', 0);
} else if (is_scalar($response['data']) || count($response['data']) === 1) {
if (is_array($response['data'])) {
list($response['data']) = $response['data'];
}
$select->where('activity_stream.target_id', $response['data']);
} else if (is_array($response['data'])) {
$select->whereIn('activity_stream.target_id', (array) $response['data']);
} else {
continue;
}
$select->whereIn('activity_stream.type', $actionTypes);
$union->union($select);
}
//$union = $union->toSql();
//$result = DB::statement($union);
$result = $union->get();
die;
Thanks in advance friends,
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community