Make code compatible with 5.3 :(

[MAILPOET-1279]
This commit is contained in:
Pavel Dohnal
2018-02-21 14:11:48 +00:00
parent 2c020bf283
commit c3f974a3c0

View File

@@ -250,9 +250,13 @@ class Segment extends Model {
static function getAnalytics() {
$analytics = Segment::select_expr('type, count(*) as count')
->whereNull('deleted_at')
->groupBy('type')
->findArray();
return array_combine(array_column($analytics, 'type'), array_column($analytics, 'count'));
->whereNull('deleted_at')
->groupBy('type')
->findArray();
$result = array();
foreach($analytics as $segment) {
$result[$segment['type']] = $segment['count'];
}
return $result;
}
}