Esempio n. 1
0
 /**
  * Removes tags with no associated posts
  *
  * @return  $this->listRefresh()
  */
 public function index_onRemoveOrphanedTags()
 {
     if (!($delete = Tag::has('items', 0)->delete())) {
         return Flash::error('An unknown error has occured.');
     }
     Flash::success('Successfully deleted orphaned tags.');
     return $this->listRefresh();
 }
Esempio n. 2
0
 public function save(array $options = NULL, $sessionKey = NULL)
 {
     parent::save($options, $sessionKey);
     if ($this->tags) {
         $ids = [];
         foreach ($this->tags as $name) {
             $create = Tag::firstOrCreate(['name' => $name]);
             $ids[] = $create->id;
         }
         $this->tags()->sync($ids);
     }
 }
 public function run()
 {
     // exit when items are found
     if (Item::count()) {
         return false;
     }
     /**
      * Add example category
      */
     $ec = Category::create(['name' => 'Examples', 'slug' => 'examples']);
     /**
      * Add example tag
      */
     $t1 = Tag::create(['name' => 'one']);
     /**
      * Add example item
      */
     $i1 = Item::create(['category_id' => $ec->id, 'title' => 'Proactively disseminate', 'slug' => 'proactively', 'description' => 'Proactively disseminate parallel markets after open-source e-services. Quickly administrate goal-oriented sources through turnkey human capital. Intrinsicly transition installed base schemas with reliable resources. Proactively leverage other\'s compelling mindshare with interoperable applications. Holisticly aggregate transparent metrics through just in time value. Conveniently target pandemic paradigms through leading-edge intellectual capital. Authoritatively create next-generation products rather than reliable platforms. Dramatically predominate robust materials rather than principle-centered innovation. Quickly simplify market positioning niches through equity invested outsourcing. Intrinsicly integrate progressive niche markets.']);
     $i1->tags()->attach($t1->id);
     //TODO: find a way to attach sample images to the items.
 }
Esempio n. 4
0
 /**
  * Get the selected tag object for processing
  *
  * @param $selectedTag
  * @return mixed
  */
 protected function loadItemsByTag($selectedTag)
 {
     $tag = Tag::where('name', '=', $selectedTag)->first();
     return $tag;
 }