loadDefaultValues(); return $model; } public function getFriendlyLinks() { return FriendlyLink::find()->where(['status' => FriendlyLink::DISPLAY_YES])->orderBy(['sort' => SORT_ASC, 'id' => SORT_DESC])->all(); } public function getFriendlyLinkCountByPeriod($startAt=null, $endAt=null) { $model = FriendlyLink::find(); if( $startAt != null && $endAt != null ){ $model->andWhere(["between", "created_at", $startAt, $endAt]); }else if ($startAt != null){ $model->andwhere([">", "created_at", $startAt]); } else if($endAt != null){ $model->andWhere(["<", "created_at", $endAt]); } return $model->count('id'); } }