public function deleteTracks(string $typeName, ?int $typeId = null, ?int $expiryTime = 0, int $trackableType = Tracker::TRACKER_LIVE) : int
    {
        $query = $this->getModel()
            ->newQuery()
            ->where('type', $this->getAlias($typeName));

        if ($typeId !== -1) {
            $query->where('type_id', $typeId);
        }

        if ($expiryTime !== null && $expiryTime > 0) {
            $query->whereRaw('(TIMESTAMPDIFF(MINUTE, created_at, NOW()) >= ?)', $expiryTime);
        }

        $query->where($this->typeClosure($trackableType));

        return $query->delete();
    }
public function deleteTracks(string $typeName, ?int $typeId = null, ?int $expiryTime = 0, int $trackableType = Tracker::TRACKER_LIVE) : int
    {
        $query = $this->getModel()
            ->newQuery()
            ->where('type', $this->getAlias($typeName));

        if ($typeId !== -1) {
            $query->where('type_id', $typeId);
        }

        if ($expiryTime !== null && $expiryTime > 0) {
            $query->whereRaw('(TIMESTAMPDIFF(MINUTE, created_at, NOW()) >= ?)', $expiryTime);
        }

        $query->where($this->typeClosure($trackableType));

        return $query->delete();
    }
public function deleteTracks ( string $ typeName , ? int $ typeId = null , ? int $ expiryTime = 0 , int $ trackableType = Tracker :: TRACKER_LIVE ) : int { $ query = $ this -> getModel ( ) -> newQuery ( ) -> where ( 'type' , $ this -> getAlias ( $ typeName ) ) ; if ( $ typeId !== - 1 ) { $ query -> where ( 'type_id' , $ typeId ) ; } if ( $ expiryTime !== null && $ expiryTime > 0 ) { $ query -> whereRaw ( '(TIMESTAMPDIFF(MINUTE, created_at, NOW()) >= ?)' , $ expiryTime ) ; } $ query -> where ( $ this -> typeClosure ( $ trackableType ) ) ; return $ query -> delete ( ) ; }
Delete tracks for given type

@param string    $typeName
@param int|null  $typeId
@param int       $expiryTime Time in seconds to delete for, 0 for all
@param int       $trackableType
@return int
Delete tracks for given type