当前位置: 首页>>代码示例>>PHP>>正文


PHP Tag::orderBy方法代码示例

本文整理汇总了PHP中app\Tag::orderBy方法的典型用法代码示例。如果您正苦于以下问题:PHP Tag::orderBy方法的具体用法?PHP Tag::orderBy怎么用?PHP Tag::orderBy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\Tag的用法示例。


在下文中一共展示了Tag::orderBy方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: index

 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');
 }
开发者ID:santakani,项目名称:santakani.com,代码行数:33,代码来源:SitemapController.php

示例2: compose

 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);
 }
开发者ID:EstevenJaviier,项目名称:Semillero-IN,代码行数:7,代码来源:AsideComposer.php

示例3: store

 /**
  * 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());
 }
开发者ID:nahid1991,项目名称:LoginTest,代码行数:32,代码来源:TagController.php

示例4: show

 /**
  * 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);
     }
 }
开发者ID:RuseHackV2,项目名称:MeetUpr,代码行数:40,代码来源:EventsController.php

示例5: getCreate

 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;
 }
开发者ID:ThunderID,项目名称:capcus.v2,代码行数:35,代码来源:TourController.php

示例6: edit

 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'));
 }
开发者ID:9IPHP,项目名称:LaravelBlog,代码行数:7,代码来源:ArticleController.php

示例7: edit

 /**
  * 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);
 }
开发者ID:rikardote,项目名称:larablog,代码行数:14,代码来源:ArticlesController.php

示例8: index

 /**
  * 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);
 }
开发者ID:sebasPintoO,项目名称:bloglaravel,代码行数:13,代码来源:IndexController.php

示例9: viewReadAll

 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);
 }
开发者ID:JCStraw3,项目名称:photos,代码行数:9,代码来源:TagController.php

示例10: edit

 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]);
 }
开发者ID:blitzkriegcoding,项目名称:blog_cf,代码行数:9,代码来源:ArticlesController.php

示例11: index

 /**
  * 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.');
     }
 }
开发者ID:ahmed-raza,项目名称:lara_new,代码行数:16,代码来源:AdminController.php

示例12: index

 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);
 }
开发者ID:sebasPintoO,项目名称:bloglaravel,代码行数:12,代码来源:FrontController.php

示例13: edit

 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);
 }
开发者ID:kyrayagami,项目名称:proyecto,代码行数:13,代码来源:ProgramasController.php

示例14: getCreate

 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;
 }
开发者ID:ThunderID,项目名称:capcus.v2,代码行数:20,代码来源:PlaceController.php

示例15: index

 public function index()
 {
     $tags = Tag::orderBy('id', 'desc')->paginate(15);
     return view('admin.tags.index', compact('tags'));
 }
开发者ID:hushibing,项目名称:laravel51,代码行数:5,代码来源:TagController.php


注:本文中的app\Tag::orderBy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。