Exemple #1
0
 public static function getTagsByBlogId(array $data, $blogId)
 {
     if ($blog = Blog::findBlog($data, $blogId)) {
         $tags = [];
         foreach ($blog->tags as $tag) {
             $tags[] = $tag->toArray();
         }
         return $tags;
     }
     return false;
 }
Exemple #2
0
 public function readAll(ReadRequest $request)
 {
     if ($blogs = BlogModel::findBlog($request->input())) {
         $data = [];
         foreach ($blogs as $blog) {
             $data[] = $this->getFullData($blog);
         }
         $message = $this->getMessage('success', $data);
     } else {
         $message = $this->getMessage('error', [Request::ERROR_DATABASE_BLOG_NOT_FOUND]);
     }
     return json_encode($message);
 }