public function index($username) { $articles = Article::where('user_id', '=', auth()->user()->id)->orderBy('created_at', 'desc')->get(); $categories = Category::all(); $tags = Tag::all(); return view('articles.new')->with(['articles' => $articles, 'categories' => $categories, 'tags' => $tags]); }
public function editTag($id) { $notif = self::getNotif(); $currentTag = Tag::findOrFail($id); $tags = Tag::all(); return view('adminPanel.editTag', compact('tags', 'currentTag', 'notif')); }
public function tag($name) { $tag = \App\Tag::where('name', '=', $name)->firstOrFail(); $tags = \App\Tag::all(); $posts = $tag->posts; return view('frontend.pages.tag')->with('posts', $posts)->with('tags', $tags)->with('tag', $tag); }
public function __construct() { $this->postParser = new PostParser(); $this->tags = Tag::all(); $this->dificultyLevels = PostDificulty::all(); $this->posts = Post::all(); }
/** * Display a listing of the resource. * * @return Response */ public function tagTattoo() { $user = Auth::user(); $tattoos = Tattoo::where('tags_count', 0)->paginate(20); $tags = Tag::all(); return view('admin.tagTattoo', ['tattoos' => $tattoos, 'tags' => $tags]); }
/** * List the tags * @param $date */ public function index() { $tags = Tag::all(); // return $articles; // return view('articles.index')->with('articles', $articles); return view('tags.index', compact('tags')); }
/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit($id) { $post = Post::find($id); $tags = Tag::all(); $title = 'Editer une conférence'; return view('dashboard.edit', compact('post', 'tags', 'title')); }
/** * Run the database seeds. * * @return void */ public function run() { $faker = Faker::Create(); foreach (range(1, 10) as $seededItem) { User::create(['first_name' => $faker->name, 'last_name' => $faker->name, 'password' => Hash::make('123456'), 'type' => false, 'sex' => $faker->boolean(), 'email' => $faker->email, 'date_of_birth' => $faker->date('Y-m-d')]); } $users = User::all()->lists('id')->toArray(); foreach (range(1, 100) as $seededItem) { Post::create(['user_id' => $faker->randomElement($users), 'body' => $faker->text, 'vote_count' => 0]); } $posts = Post::all()->lists('id')->toArray(); Comment::create(['user_id' => $faker->randomElement($users), 'body' => $faker->text, 'vote_count' => 0, 'parent_id' => null]); foreach (range(1, 100) as $seededItem) { Post_Vote::create(['user_id' => $faker->randomElement($users), 'post_id' => $faker->randomElement($posts), 'up' => $faker->boolean()]); Comment::create(['user_id' => $faker->randomElement($users), 'parent_id' => $faker->randomElement(Comment::all()->lists('id')->toArray()), 'post_id' => $faker->randomElement($posts), 'body' => $faker->text, 'vote_count' => 0]); Tag::create(['name' => $faker->text, 'private' => $faker->boolean()]); } $comments = Comment::all()->lists('id')->toArray(); $tags = Tag::all()->lists('id')->toArray(); foreach (range(1, 100) as $seededItem) { Comment_Vote::create(['user_id' => $faker->randomElement($users), 'comment_id' => $faker->randomElement($comments), 'up' => $faker->boolean()]); Tag_User::create(['user_id' => $faker->randomElement($users), 'tag_id' => $faker->randomElement($tags)]); Post_Tag::create(['tag_id' => $faker->randomElement($tags), 'post_id' => $faker->randomElement($posts)]); } }
/** * Display a listing of the resource associated with the tag name. * * @param Tag $tag * @return \Illuminate\Http\Response */ public function tagged(Tag $tag) { $admin = User::first(); $tags = Tag::all(); $articles = $tag->publishedArticles()->get(); $currentTag = $tag; return view($this->theme() . 'home', compact('articles', 'currentTag', 'admin', 'tags')); }
/** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit($id) { $product = Product::find($id); $tags = Tag::all(); $cats = $this->categoryTitleAndId(); $product->status == 'published' ? $published = true : ($published = false); return view('admin.product.edit', compact('product', 'cats', 'tags')); }
/** * Display the specified resource. * * @param int $id * @return Response */ public function show($slug) { $category = Category::where('slug', $slug)->first(); $articles = $category->articles()->get(); $categories = Category::all(); $tags = Tag::all(); return view('articles.categories.show', compact('articles', 'categories', 'tags')); }
public function tag($id) { $categories = $this->categories(); $articles = Tag::findOrFail($id)->articles()->orderBy('id', 'desc')->paginate(8); $tag = Tag::findOrFail($id); $tags = Tag::all(); return view('home.tag', compact('categories', 'tag', 'articles', 'tags')); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $tags = Tag::all(); foreach ($tags as $tag) { echo $tag->tag; echo '<br>'; } // return view('tags/tags')->with(['tags' => $tags]); }
/** * Bootstrap the application services. * * @return void */ public function boot() { view()->composer('partials._blog-aside', function ($view) { $view->with('postDate', Article::all()->groupBy(function ($date) { return Carbon::parse($date->created_at)->format('M-y'); })); $view->with('tags', Tag::all()); }); }
public function get_tags() { $tags = Tag::all()->toArray(); $result = []; foreach ($tags as $tag) { $result[] = ['id' => $tag['id'], 'text' => $tag['name']]; } return $result; }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index(Request $request) { $tags = Tag::all(); foreach ($tags as $key => $value) { $list[$key]['id'] = $value->id; $list[$key]['text'] = $value->name; } return $list; }
/** * Display a listing of the resource. * * @return Response */ public function index() { $tags = Tag::all(); if (!empty($tags)) { return response()->json(array('error' => false, 'tags' => $tags), 200); } else { return response()->json(array('error' => false, 'tags' => 'No tags found.'), 200); } }
/** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit($id) { $product = Product::find($id); $tab = $product->tableauTags(); $tags = Tag::all(); $categories = Category::all(); $catProd = $product->category->title; return view('admin.modifProduct', compact('product', 'tab', 'tagsProd', 'tags', 'categories', 'catProd')); }
/** * Display a listing of the resource. * * @return Response */ public function index() { $games = Game::all(); if (Input::get('date') == 'date') { $games = $games->reverse(); } $tags = Tag::all(); return view('games.index', compact('games', 'tags')); }
/** * Display a listing of the resource. * * @return Response */ public function index() { $token = JWTAuth::getToken(); $user = JWTAuth::toUser($token); $data['user'] = Auth::User(); $data['tasks'] = Task::with('priority', 'tags')->own()->get(); $data['priorities'] = Priority::all(); $data['tags'] = Tag::all(); return response()->json($data); }
public function all() { $tag = new Tag(); $all = Tag::all(['id', 'tag as text']); if (\Input::has('isWeekly')) { $weeklyTag = $tag->getRecentlyWeeklyTag(); return ['tags' => $all, 'wrTag' => $weeklyTag]; } return $all; }
private function composeSidebar() { view()->composer('home.partials.sidebar', function ($view) { $allTags = \App\Tag::all(); $allCategories = \App\Category::getSortedCategories(); $NewestArticles = \App\Article::latest()->take(15)->get(); $hottestArticles = \App\Article::orderBy('click')->take(15)->get(); $view->with(compact('allTags', 'allCategories', 'NewestArticles', 'hottestArticles')); }); }
public function __construct() { // injecter du code dans la vue 'partials.categories' : ($view -> template) view::composer('partials.categories', function ($view) { $view->with('categories', Category::all()); }); view::composer('partials.tags', function ($view) { $view->with('tags', Tag::all()); }); }
public function getDashboardData() { $blogCount = Blog::all()->count(); $tagCount = Tag::all()->count(); $contactCount = ContactMails::where('messageStatus', 0)->count(); $totalCount = ContactMails::all()->count(); $totalHit = UserLog::all()->count(); return 1; #$Response = array('success' => '1', 'blogCount' => $blogCount, 'tagCount' => $tagCount , 'contactCount' => $contactCount, 'totalCount' => 'totalHit' => $totalHit); }
public function syncTags(Article $article, $tags = array(), $isNew = false) { $tagall = Tag::all()->toArray(); $newTagIds = $updateTagIds = $existingSlug = $existingTag = []; if (!empty($tagall)) { foreach ($tagall as $tag) { $existingSlug[] = $tag['slug']; $existingTag[$tag['slug']] = $tag; } } unset($tagall); if ($tags) { foreach ($tags as $tag) { if (!in_array(mb_strtolower($tag, 'UTF-8'), $existingSlug)) { $name = filter_allowed_words($tag); $slug = preg_replace('/\\s+/', '-', mb_strtolower($name, 'UTF-8')); if (in_array($slug, $existingSlug)) { if ($isNew) { Tag::whereSlug($slug)->increment('count'); } $updateTagIds[] = $existingTag[$slug]['id']; } else { $firstLetter = getFirstLetter($name); $newtag = Tag::create(array('name' => $name, 'slug' => $slug, 'letter' => $firstLetter)); $newId = $newtag->id; $newTagIds[] = $newId; $updateTagIds[] = $newId; } } else { if ($isNew) { Tag::whereSlug($tag)->increment('count'); } $updateTagIds[] = $existingTag[$tag]['id']; } } } $updateTagIds = array_unique($updateTagIds); if (!$isNew) { $oldTagIds = $article->tags->lists('id')->toArray(); $delTagIds = array_diff($oldTagIds, $updateTagIds); $addTagIds = array_diff($updateTagIds, $oldTagIds); if (!empty($delTagIds)) { Tag::whereIn('id', $delTagIds)->decrement('count'); } if (!empty($addTagIds)) { foreach ($addTagIds as $addId) { if (!in_array($addId, $newTagIds)) { Tag::whereId($addId)->increment('count'); } } } } $article->tags()->sync($updateTagIds); unset($newTagIds, $updateTagIds, $existingSlug, $existingTag); }
public function edit($id) { $locations = Location::all(); $options = array(); foreach ($locations as $location) { $options[$location->name] = $location->description; } $group = FbGroup::where('id', $id)->firstOrFail(); $tags = Tag::all(); return view('facebook.group.edit')->with('tags', $tags)->with('options', $options)->with('group', $group); }
public function tag($slug) { $tag = Tag::getBy($slug); if (empty($tag)) { abort(404); } $data['tag'] = $tag; $data['tags'] = Tag::all(); $data['sidebar'] = (object) ['latest_posts' => Post::getLatest(), 'popular_posts' => Post::getPopular()]; return view('home.post', $data); }
public function __construct() { // Get all categories View::composer('partials.main_menu', function ($view) { $view->with('categories', Category::all()); }); // Get all tags View::composer('front.partials.menu', function ($view) { $view->with('allTags', Tag::all()); }); }
/** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit($id) { $product = Product::find($id); $tags = Tag::all(); $cats = Category::all(); $cates = array(); foreach ($cats as $cat) { $cates[$cat->id] = $cat->title; } return view('admin.editproduct', compact('product', 'cates', $cates, 'tags')); }
public function edit($id) { $article = Article::findOrFail($id); $categories = Category::getLeveledCategories(); $tags = Tag::all(); $article_tags = Article::findOrFail($id)->tags->toArray(); foreach ($article_tags as $article_tag) { $ctags[] = $article_tag['pivot']['tag_id']; } $article_tags = empty($ctags) ? array('0') : $ctags; return view('admin.articles.edit', compact('categories', 'tags', 'article', 'article_tags')); }