public function index() { // create new sitemap object $sitemap = App::make("sitemap"); // set cache key (string), duration in minutes (Carbon|Datetime|int), turn on/off (boolean) // by default cache is disabled $sitemap->setCache('laravel.sitemap', 60); // check if there is cached sitemap and build new only if is not if (!$sitemap->isCached()) { // add item to the sitemap (url, date, priority, freq) $sitemap->add(url('about'), Carbon::createFromDate(2016, 7, 15), '0.3', 'monthly'); $sitemap->add(url('privacy'), Carbon::createFromDate(2016, 7, 15), '0.3', 'monthly'); $sitemap->add(url('terms'), Carbon::createFromDate(2016, 7, 15), '0.3', 'monthly'); $designers = Designer::orderBy('created_at', 'desc')->get(); foreach ($designers as $designer) { $sitemap->add($designer->url, $designer->updated_at, 0.8, 'daily'); } $places = Place::orderBy('created_at', 'desc')->get(); foreach ($places as $place) { $sitemap->add($place->url, $place->updated_at, 0.8, 'daily'); } $stories = Story::orderBy('created_at', 'desc')->get(); foreach ($stories as $story) { $sitemap->add($story->url, $story->updated_at, 0.8, 'daily'); } $tags = Tag::orderBy('created_at', 'desc')->get(); foreach ($tags as $tag) { $sitemap->add($tag->url, $tag->updated_at, 0.8, 'weekly'); } } // show your sitemap (options: 'xml' (default), 'html', 'txt', 'ror-rss', 'ror-rdf') return $sitemap->render('xml'); }
public function compose(View $view) { $tags = Tag::orderBy('id', 'DESC')->get(); $categories = Category::orderBy('id', 'DESC')->simplepaginate(7); $images = Image::orderBy('id', 'DESC')->paginate(4); $view->with('tags', $tags)->with('categories', $categories)->with('images', $images); }
/** * Store a newly created resource in storage. * * @return Response */ public function store(TagRequest $request) { $user = \Auth::user(); // $newTags = array(); // foreach(explode(" ", $request->input("name")) as $new) // { // $newTags = array("name" => $new); // Tag::create($newTags); // } $count = DB::table('tag_faculty')->where('username', $user->username)->count(); if ($count < 4) { Tag::create($request->all()); $forQuery = Tag::orderBy('created_at', 'desc')->first(); DB::table('tag_faculty')->insert(['tag_id' => $forQuery->id, 'username' => $user->username]); // $tags = DB::table('tag_faculty') // ->join('tags', 'tag_faculty.tag_id', '=', 'tags.id') // ->join('users', 'tag_faculty.username', '=', 'users.username') // ->where('users.username', $user->username) // ->get(); return redirect('/dash-board'); } else { $error = "Your tag limit has exceeded"; return redirect('/dash-board')->withErrors($error); } // dd($request->input('tags')); // Tag::create($request->all()); }
/** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show($id) { $event = Event::find($id); $event->host = User::find($event->user_id); $event->host->userTags = self::getTagsForUser($event->host->id); $peopleCount = \DB::table('event_user')->where('event_id', $id)->where('status', 'approved')->count(); $event->players = \DB::table('event_user')->select('user_id')->where('event_id', $event->id)->where('status', 'approved')->get(); foreach ($event->players as $player) { $player->object = User::find($player->user_id); $player->object->userTags = self::getTagsForUser($player->object->id); } $is_host = false; $listTags = []; $tags = Tag::orderBy('name')->get(); foreach ($tags as $tag) { $listTags[$tag->id] = $tag->name; } if (\Auth::user()->id == $event->host->id) { $is_host = true; $requests = \DB::table('event_user')->where('event_id', $event->id)->where('status', 'pending')->get(); foreach ($requests as $request) { $request->user = User::find($request->user_id); } return view('events.show')->with('event', $event)->with('peopleCount', $peopleCount)->with('requests', $requests)->with('tags', $listTags)->with('is_host', $is_host); } else { $applied = \DB::table('event_user')->where('event_id', $event->id)->where('user_id', \Auth::id())->get(); if (empty($applied)) { $appliedStatus = 'not applied'; } else { $appliedStatus = $applied[0]->status; } return view('events.show')->with('event', $event)->with('peopleCount', $peopleCount)->with('is_host', $is_host)->with('applied', $applied)->with('tags', $listTags)->with('appliedStatus', $appliedStatus); } }
public function getCreate($data = null) { // ------------------------------------------------------------------------------------------------------------ // GET TRAVEL AGENTS // ------------------------------------------------------------------------------------------------------------ $travel_agents = \App\TravelAgent::orderBy('name')->get(); // ------------------------------------------------------------------------------------------------------------ // GET DESTINATIONS // ------------------------------------------------------------------------------------------------------------ $destinations = \App\Destination::orderBy('path')->get(); // ------------------------------------------------------------------------------------------------------------ // GET PLACES // ------------------------------------------------------------------------------------------------------------ $places = \App\Place::orderBy('long_name')->get(); // ------------------------------------------------------------------------------------------------------------ // GET TOUR OPTIONS // ------------------------------------------------------------------------------------------------------------ $tour_options = \App\TourOption::orderBy('name')->get(); // ------------------------------------------------------------------------------------------------------------ // GET TAGS // ------------------------------------------------------------------------------------------------------------ $tag_list = \App\Tag::orderBy('tag')->get(); // ------------------------------------------------------------------------------------------------------------ // SHOW DISPLAY // ------------------------------------------------------------------------------------------------------------ $this->layout->page = view($this->page_base_dir . 'create')->with('route_name', $this->route_name)->with('view_name', $this->view_name); $this->layout->page->data = $data; $this->layout->page->travel_agents = $travel_agents; $this->layout->page->destinations = $destinations; $this->layout->page->places = $places; $this->layout->page->tour_options = $tour_options; $this->layout->page->tag_list = $tag_list; $this->layout->page->required_images = $this->required_images; return $this->layout; }
public function edit(Article $article) { $this->authorize('owns', $article); $article->body = htmlspecialchars($article->body); $tags = Tag::orderBy('count', 'desc')->lists('name', 'slug')->toArray(); return view('articles.edit', compact('article', 'tags')); }
/** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit($id) { $article = Article::find($id); $categories = Category::orderBy('name', 'DESC')->lists('name', 'id'); $tags = Tag::orderBy('name', 'DESC')->lists('name', 'id'); $my_tags = $article->tags->lists('id')->toArray(); return view('admin.articles.edit')->with('categories', $categories)->with('tags', $tags)->with('article', $article)->with('my_tags', $my_tags); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $articles = Article::OrderBy('id', 'DESC')->paginate(7); $categories = Category::orderBy('name', 'ASC')->get(); $tags = Tag::orderBy('name', 'ASC')->get(); $images = Image::orderBy('article_id', 'DESC')->get(); return view('admin.index')->with('articles', $articles)->with('tags', $tags)->with('images', $images)->with('categories', $categories); }
public function viewReadAll() { // Set logged in user to a variable. $authUser = Auth::user(); // Find all tags in database. $tags = Tag::orderBy('name', 'asc')->get(); // Return view with variables. return view('tags.viewReadAll')->with('tags', $tags)->with('authUser', $authUser); }
public function edit($id) { $article = Article::find($id); $article->category; $categories = Category::orderBy('name', 'DESC')->lists('name', 'id'); $tags = Tag::orderBy('name', 'DESC')->lists('name', 'id'); $my_tags = $article->tags->lists('id')->ToArray(); return view('admin.articles.edit')->with(['categories' => $categories, 'article' => $article, 'tags' => $tags, 'my_tags' => $my_tags]); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { if (Auth::user() && Auth::user()->rank == 'admin') { $articles = Article::orderBy('created_at', 'DESC')->take(5)->get(); $users = User::orderBy('created_at', 'DESC')->take(10)->get(); $tags = Tag::orderBy('created_at', 'DESC')->take(5)->get(); return view('admin.index', compact('articles', 'users', 'tags')); } else { return redirect('/')->with('error', 'You are not authorized to access that page.'); } }
public function index() { $articles = Article::OrderBy('id', 'DESC')->paginate(3); $articles->each(function ($articles) { $articles->category; $articles->images; $articles->lists('category_id'); }); $categories = Category::OrderBy('name', 'ASC')->get(); $tags = Tag::orderBy('name', 'ASC')->get(); return view('front.index')->with('articles', $articles)->with('tags', $tags)->with('categories', $categories); }
public function edit($id) { $programa = Programa::find($id); $programa->categoria(); $programa->productor(); $categorias = Categoria::orderBy('nombre', 'DESC')->lists('nombre', 'id'); $productores = Productor::orderBy('nombre', 'ASC')->where('estatus', '=', 'ACTIVO')->lists('nombre', 'id'); $tags = Tag::orderBy('id', 'DESC')->lists('nombre', 'id'); $mis_tags = $programa->tags->lists('id')->ToArray(); $conductores = Conductor::orderBy('id', 'DESC')->where('estatus', '=', 'ACTIVO')->lists('nombre', 'id'); $mis_conductores = $programa->conductores->lists('id')->ToArray(); return view('admin.programas.edit')->with('programa', $programa)->with('productores', $productores)->with('categorias', $categorias)->with('tags', $tags)->with('mis_tags', $mis_tags)->with('conductores', $conductores)->with('mis_conductores', $mis_conductores); }
public function getCreate($data = null) { // ------------------------------------------------------------------------------------------------------------ // DESTINATION // ------------------------------------------------------------------------------------------------------------ $destinations = \App\Destination::orderBy(\App\Destination::getPathField()); // ------------------------------------------------------------------------------------------------------------ // TAG // ------------------------------------------------------------------------------------------------------------ $tag_list = \App\Tag::orderBy('tag')->get(); // ------------------------------------------------------------------------------------------------------------ // SHOW DISPLAY // ------------------------------------------------------------------------------------------------------------ $this->layout->page = view($this->page_base_dir . 'create')->with('route_name', $this->route_name)->with('view_name', $this->view_name); $this->layout->page->data = $data; $this->layout->page->required_images = $this->required_images; $this->layout->page->destinations = $destinations; $this->layout->page->tag_list = $tag_list; return $this->layout; }
public function index() { $tags = Tag::orderBy('id', 'desc')->paginate(15); return view('admin.tags.index', compact('tags')); }
public function edit(Article $article) { $this->authorize('update', $article); $tags = Tag::orderBy('count', 'desc')->lists('name', 'slug')->toArray(); return view('articles.edit', compact('article', 'tags')); }
public function memeGeneratorMobile() { $notif = self::getNotif(); $tags = Tag::orderBy('navbarMainOrder', 'ASC')->where('navbarMainOrder', '>', 0)->get(); return view('creater.memeGeneratorMobile', compact('tags', 'notif')); }
/** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit($id) { $article = Article::find($id); $article->category; // Esta la obtiene del modelo. // Esta función del modelo nos // trae la relación que tenemos // con las categorias //dd($article->category->id); $categories = Category::orderBy('name', 'DESC')->lists('name', 'id'); $tags = Tag::orderBy('name', 'DESC')->lists('name', 'id'); $my_tags = $article->tags->lists('id')->ToArray(); // si le quitamos la funcion ToArray, nos // devolvería un array dentro de un Objeto, y // lo que queremos es sólo un Array //dd($my_tags); return view('admin.articles.edit')->with('categories', $categories)->with('article', $article)->with('tags', $tags)->with('my_tags', $my_tags); }
/** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit($id) { $article = Article::find($id); $article->category; $tags = Tag::orderBy('name', 'DESC')->lists('name', 'id'); $categories = Category::orderBy('name', 'DESC')->lists('name', 'id'); /** * obtener los tags a través de la relación del artículo, * y convertirlo en un array (no se puede pasar como colección u objeto) */ $my_tags = $article->tags->lists('id')->ToArray(); return view('admin.articles.edit', compact('categories', 'article', 'tags', 'my_tags')); }
public function compose(View $view) { $categories = Category::orderBy('name', 'DESC')->get(); $tags = Tag::orderBy('name', 'DESC')->get(); $view->with('categories', $categories)->with('tags', $tags); }
public function all() { return Tag::orderBy('title')->get(); }
public function tags(Request $request) { $orderby = $request->orderby ? $request->orderby : 'created_at'; $name = $request->name ? $request->name : ''; $tags = Tag::orderBy($orderby, 'DESC')->whereName($name)->paginate(10); // dd($tags); return view('admin.articles.tags', compact('tags', 'orderby', 'name')); }
/** * Hiển thị danh sách * * @return Response */ public function index() { $tags = Tag::orderBy('id', 'desc')->paginate(config('blog.record_per_page')); return view('admin.tags.index', compact('tags')); }
/** * Show the form for creating a new resource. * * @return \Illuminate\Http\Response */ public function create() { $categories = Category::orderBy('name', 'ASC')->lists('name', 'id'); $tags = Tag::orderBy('name', 'ASC')->lists('name', 'id'); return view('admin.articles.create')->with('categories', $categories)->with('tags', $tags); }
public function index() { $tags = Tag::orderBy('name', 'asc')->get(); return view('tags.tag-listing', compact('tags')); }