typePublic()->andWhere(['>', 'depth', 0])->all(); } public function find($id): ?Page { return Page::findOne($id); } public function findBySlug($slug): ?Page { return Page::find()->typePublic()->andWhere(['slug' => $slug])->andWhere(['>', 'depth', 0])->one(); } public function findPreview($id, $language): ?Page { return $language ? Page::find()->localized($language)->andWhere(['id' => $id])->one() : Page::find()->andWhere(['id' => $id])->one(); } }