/**
  * @param $field
  * @param $value
  * @param FrontendPage $parentPage
  * @param bool $includeHidden
  * @return bool|FrontendPage
  */
 public static function findByField($field, $value, FrontendPage $parentPage = null, $includeHidden = true)
 {
     $pageCacheId = static::getCacheId([$field, $value, $includeHidden ? 'TRUE' : 'FALSE'], $parentPage);
     if (isset(static::$pagesCache[$pageCacheId])) {
         return static::$pagesCache[$pageCacheId];
     }
     $pageClass = get_called_class();
     $query = DB::table('pages')->where('pages.' . $field, $value)->whereIn('status', static::getStatuses($includeHidden));
     if (config('pages::checkDate') === true) {
         $query->where('published_at', '<=', DB::raw('NOW()'));
     }
     if (!is_null($parentPage)) {
         $query->where('parent_id', $parentPage->id);
     }
     // TODO: добавить кеширование на основе тегов
     $foundPage = Cache::remember($pageCacheId, Carbon::now()->addMinutes(10), function () use($query) {
         return $query->take(1)->first();
     });
     if (is_null($foundPage)) {
         return null;
     }
     $foundPageObject = new FrontendPage($foundPage);
     if (is_null($parentPage) and !is_null($foundPageObject->getParentId())) {
         $parentPage = static::findById($foundPageObject->getParentId());
     }
     $foundPageObject->setParentPage($parentPage);
     static::$pagesCache[$pageCacheId] = $foundPageObject;
     return $foundPageObject;
 }