當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。