public function sync($object)
 {
     $cacheName = $this->getCacheName($object);
     try {
         $count = Cache::get($cacheName);
         if (!empty($count)) {
             $countType = $object->action . '_counter';
             Counter::updateOrCreate(['class_name' => $object->class_name, 'object_id' => $object->object_id, 'count_date' => date('Y-m-d')], [$countType => $count, 'count_date' => date('Y-m-d')]);
             return true;
         } else {
             return false;
         }
     } catch (\Exception $e) {
         Log::error($e->getMessage());
         return false;
     }
 }
 /**
  * return the counter object of the model
  */
 public function counter()
 {
     if (!isset($this->counter)) {
         $class_name = $this->getClassName();
         $this->counter = Counter::where('class_name', $class_name)->where('object_id', $this->id)->orderBy('count_date', 'desc')->first();
         if (!$this->counter) {
             $this->counter = Counter::create(array('class_name' => $class_name, 'object_id' => $this->id, 'count_date' => date('Y-m-d')));
         }
     }
     return $this->counter;
 }