public function getPostBySlug($slug) { $post = Posts::findFirstBySlug($slug); if (!$post) { return null; } return $post; }