예제 #1
0
 /**
  * /*
  * Syncronize  tags
  *
  * @param Page $page
  * @param array $tags
  */
 private function syncTags(Page $page, array $tags)
 {
     foreach ($tags as $tag_id) {
         if (!is_numeric($tag_id)) {
             //$newTag = $tag_id;
             $newTag = substr($tag_id, 3);
             if (strlen($newTag) >= 3) {
                 $new_tag = Tag::create(['slug' => str_slug(str_replace('_', ' ', $newTag)), 'name' => str_replace('_', ' ', $newTag), 3]);
                 $tag_id = $new_tag->id;
                 $allTagIds[] = $tag_id;
             }
         } else {
             $allTagIds[] = $tag_id;
         }
     }
     $page->tags()->sync($allTagIds);
 }
예제 #2
0
 public function destroy(Tag $tag, $tag_id)
 {
     $tag->destroy($tag_id);
     return redirect()->action('\\Tok3\\Publisher\\Http\\TagsController@index');
 }