mirror of
https://github.com/SophiaAtkinson/steamwidgets-web.git
synced 2025-06-27 03:57:41 -07:00
Redundancy filter
This commit is contained in:
@ -92,11 +92,20 @@ class HitsModel extends \Asatru\Database\Model
|
||||
public static function getReferrers($start, $end)
|
||||
{
|
||||
try {
|
||||
$result = HitsModel::raw('SELECT DISTINCT referrer FROM `' . self::tableName() . '` WHERE DATE(created_at) >= ? AND DATE(created_at) <= ? ORDER BY referrer ASC', [
|
||||
$items = HitsModel::raw('SELECT DISTINCT referrer FROM `' . self::tableName() . '` WHERE DATE(created_at) >= ? AND DATE(created_at) <= ? ORDER BY referrer ASC', [
|
||||
$start,
|
||||
$end
|
||||
]);
|
||||
|
||||
$result = [];
|
||||
|
||||
foreach ($items as $item) {
|
||||
$furl = parse_url($item->get('referrer'), PHP_URL_HOST);
|
||||
if (!in_array($furl, $result)) {
|
||||
$result[] = $furl;
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
|
Reference in New Issue
Block a user