public function random_tag() { $tags = \App\Tags::all(); $random_key = array_rand($tags->toArray(), 1); //dd($this->tags[$random_key]->name); return $tags[$random_key]->id; }
public function getAllTag() { $tag_css = array('label-default', 'label-success', 'label-warning', 'label-info'); $page_title = "All Tags"; $tags = Tags::all(); $data = compact('page_title', 'tags', 'tag_css'); return view('tags.index', $data); }
public function get_all_tags() { $tags = Tags::all()->toArray(); if (count($tags) > 0) { return $tags; } return ""; }
public function edit($id) { $article = Articles::find($id); if ($article) { $stringTags = Articles::getTagsOfStringWay($id); $tagsList = Tags::all(); return view('backend.articles.edit')->with(['tagsList' => $tagsList, 'article' => $article, 'stringTags' => $stringTags]); } else { return redirect('backend/articles/create'); } }
/** * Display a listing of the resource. * * @return Response */ public function index() { try { $resp = Tags::all(); if (!$resp) { return $this->respondNotFound(); } return Fractal::collection($resp, new \App\Transformers\TagTransformer())->responseJson(200); } catch (Exception $e) { return $this->respondWithError(); } }
/** * Display a listing of the resource. * * @return Response */ public function index() { // $tags = Tags::all(); return view('Tags.index', compact('tags')); }
/** * Display a listing of the resource. * * @return Response */ public function index() { $pageDescription = 'Tags'; $tags = Tags::all(); return view('tags.index', compact('tags', 'pageDescription')); }
public function postUpdate(Request $request) { $all = $request->all(); $validator = Validator::make($all, ['id' => 'required', 'title' => 'required|max:255', 'content' => 'required']); if (isset($all['active'])) { $all['active'] = true; } else { $all['active'] = false; } if ($validator->fails()) { $page_title = 'Edit Post'; $categories = Categories::all(); $tags = Tags::all(); $data = compact('page_title', 'categories', 'tags'); return view('posts.edit', $data)->withErrors($validator->errors()); } $post = Posts::findOrFail($all['id']); $markdown_content = $all['content']; $html_content = $this->htmlMarkdownConvertor->convertMarkdownToHtml($markdown_content); $post->title = $all['title']; $post->content = $html_content; $post->markdown_content = $markdown_content; $post->active = $all['active']; $post->category_id = $all['category_id']; if (Gate::allows('update-post', $post)) { $post->save(); $this->savePostsTags($all['tags'], $post->id); } return redirect(route('getPostPage')); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { return \App\Tags::all(); }