예제 #1
0
 /**
  * @return array
  */
 private function getOverviewData()
 {
     $archive = $this->post->where('publish_date', '<=', date('Y-m-d H:i:s'))->orderBy('publish_date', 'DESC')->get()->groupBy(function ($query) {
         return Carbon::parse($query->publish_date)->format('F Y');
     });
     $data = ['categories' => $this->category->all(), 'tags' => $this->tag->all(), 'archives' => $archive];
     return $data;
 }
예제 #2
0
 /**
  * @param $tags
  * @return array
  */
 private function buildTagsArrayForPostObject($tags)
 {
     if ($tags == "") {
         return [];
     }
     $aTags = [];
     $hashes = explode(',', $tags);
     foreach ($hashes as $tag) {
         array_push($aTags, $this->tag->byHash($tag));
     }
     return $aTags;
 }
예제 #3
0
 /**
  * @return void
  */
 private function storeOrUpdateTags()
 {
     foreach ($this->tags as $tag_name) {
         $t = $this->tag->whereName($tag_name)->first();
         if (count($t) > 0) {
             $tag = $t;
         } else {
             $tag = new Tag();
             $tag->hash = $this->blogify->makeHash('tags', 'hash', true);
         }
         $tag->name = $tag_name;
         $tag->save();
         array_push($this->stored_tags, $tag);
         $this->tracert->log('tags', $tag->id, $this->auth_user->id);
     }
 }
예제 #4
0
 /**
  * @param $hash
  * @param \jorenvanhocht\Blogify\Models\Tag $tag
  * @return mixed
  */
 public function getTag($hash, Tag $tag)
 {
     return $tag->byHash($hash);
 }