public function testCreate() { $tag = new Tag(); $tag->name = 'Some Tag'; $tag->save(); $this->assertInternalType('string', $tag->slug); $this->assertInternalType('int', $tag->id); }
/** * * @param type $tagSlug */ public function tag($id) { $tag = Tag::where('id', '=', $id)->first(); View::share('title', 'Események: ' . $tag->name); $event = Event::withAnyTag($tag->name)->orderBy('created_at', 'desc')->paginate(10); $this->layout->content = View::make('site.event.tag')->with('events', $event)->with('tag', $tag); }
/** * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View */ public function create() { $tagCollection = Tag::where('count', '>=', ENV('SUPPOSED_TAGS', 5))->get(); $tags = $tagCollection->lists('name', 'id'); $countUserQuizzes = $this->repository->countUserQuizzes(); return view('Quiz.create', compact('tags', 'countUserQuizzes')); }
/** * * @param type $tagSlug */ public function tag($id) { $tag = Tag::where('id', '=', $id)->first(['id', 'name']); View::share('title', 'Hírek: ' . $tag->name); $article = Article::withAnyTag($tag->name)->orderBy('created_at', 'desc')->paginate(10); $this->layout->content = View::make('site.article.tag')->with('articles', $article)->with('tag', $tag); }
/** * @return \Illuminate\View\View */ public function create() { $tagCollection = Tag::where('count', '>=', ENV('SUPPOSED_TAGS', 5))->get(); $tags = $tagCollection->lists('name', 'id'); $countUserPosts = $this->repository->countUserPosts(); flash()->info(trans('messages.createLang')); return view('posts.create', compact('tags', 'countUserPosts')); }
/** * Private! Please do not call this function directly, let the Tag library use it. * Decrement count of tag by one. This function will create tag record if it does not exist. * * @param string $tagString */ public static function decrementCount($tagString, $tagSlug, $count) { if ($count <= 0) { return; } $tag = Tag::where('slug', '=', $tagSlug)->first(); if ($tag) { $tag->count = $tag->count - $count; if ($tag->count < 0) { $tag->count = 0; \Log::warning("The \\Conner\\Tagging\\Tag count for `{$tag->name}` was a negative number. This probably means your data got corrupted. Please assess your code and report an issue if you find one."); } $tag->save(); } }