當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Category::orderBy方法代碼示例

本文整理匯總了PHP中app\Category::orderBy方法的典型用法代碼示例。如果您正苦於以下問題:PHP Category::orderBy方法的具體用法?PHP Category::orderBy怎麽用?PHP Category::orderBy使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在app\Category的用法示例。


在下文中一共展示了Category::orderBy方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     // obtnemos las categorias
     $categories = Category::orderBy('id', 'ASC')->paginate(5);
     // le enviamos las categorias
     return view('admin.categories.index')->with('categories', $categories);
 }
開發者ID:eloyespeche,項目名稱:BlogLaravelFinal,代碼行數:12,代碼來源:CategoriesController.php

示例2: index

 public function index()
 {
     //get all the categories
     $categories = Category::orderBy("category_id", "ASC")->paginate(20);
     //load the view and pass the categories
     return view('categories.index')->with('categories', $categories);
 }
開發者ID:blessedgem,項目名稱:GemSoft,代碼行數:7,代碼來源:CategoryController.php

示例3: 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

示例4: camposEdicion

 public function camposEdicion($id)
 {
     $product = null;
     if ($id != null) {
         $product = Product::findOrFail($id);
     }
     $categories = Category::orderBy('name', 'asc')->get();
     $arrayCat = null;
     $arrayCol = null;
     $checked = null;
     foreach ($categories as $cat) {
         $arrayCat[$cat->id] = $cat->name;
     }
     $colors = Color::orderBy('name', 'asc')->get();
     foreach ($colors as $col) {
         $arrayCol[$col->id] = ['name' => $col->name, 'checked' => ""];
         if (isset($product)) {
             $checkColor = ProductColor::where('id_product', $product->id)->where('id_color', $col->id)->count();
             if ($checkColor > 0) {
                 $arrayCol[$col->id]['checked'] = "checked";
             }
         }
     }
     return ['arrayCat' => $arrayCat, 'colors' => $arrayCol, 'product' => $product];
 }
開發者ID:serranozafra,項目名稱:pruebaHectorSerrano,代碼行數:25,代碼來源:ProductController.php

示例5: handle

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $cities = City::all();
     // Grab all the cities and then do a for each.
     // run this for each of them.
     foreach ($cities as $city) {
         $events = Event::where('city_id', '=', $city->id)->where('time_end', '>=', date('Y-m-d H:i:s'))->where('time_end', '<=', date('Y-m-d H:i:s', strtotime('+2 weeks')))->orderBy('time_start', 'asc')->get();
         if (!count($events)) {
             $this->comment('No events found for ' . $city->name . '. Mailer not sent.');
             continue;
         }
         $categories = Category::orderBy('title', 'asc')->get();
         if ($this->option('email')) {
             $subscriber = new Subscriber();
             $subscriber->name = 'Test User';
             $subscriber->email = $this->option('email');
             $subscribers = [$subscriber];
             $this->comment('Sent test email to ' . $this->option('email'));
         } else {
             $subscribers = Subscriber::where('city_id', '=', $city->id)->get();
         }
         $count = 0;
         foreach ($subscribers as $subscriber) {
             Mail::send('emails.subscribers.mailer', ['subscriber' => $subscriber, 'events' => $events, 'categories' => $categories, 'city' => $city], function ($m) use($subscriber, $city) {
                 $m->from('messages@madebyfieldwork.com', 'See+Do')->to($subscriber->email, $subscriber->name)->subject('Weekly Round-Up of Things to See+Do in ' . $city->name)->getHeaders()->addTextHeader('X-MC-Subaccount', 'see-do');
             });
             $count++;
         }
         $this->comment('Sent to ' . $count . ' email addresses in ' . $city->name . '.');
         $count = 0;
     }
 }
開發者ID:EMT,項目名稱:see-do,代碼行數:37,代碼來源:SendMailer.php

示例6: compose

 public function compose(View $view)
 {
     $categories = Cache::remember('categories', 1440, function () {
         return Category::orderBy('name')->get();
     });
     $view->with(['user' => $this->auth->user(), 'categories' => $categories, 'guest' => !$this->auth->check()]);
 }
開發者ID:net-shell,項目名稱:socialsync,代碼行數:7,代碼來源:ViewComposer.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: edit

 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $service = Service::findOrFail($id);
     $currencies = ['hrk' => 'HRK', 'usd' => 'USD', 'eur' => 'EUR'];
     $clients = Client::orderBy('name')->pluck('name', 'id')->toArray();
     $categories = Category::orderBy('name')->pluck('name', 'id')->toArray();
     return view('services.edit')->with(compact('service', 'currencies', 'clients', 'categories'));
 }
開發者ID:laravelista,項目名稱:kyle,代碼行數:14,代碼來源:ServiceController.php

示例9: getAll

 /**
  * 獲取分類列表
  *
  * @param string  $taxonomy 
  * @param array   $credential 
  * @param boolean $tree
  *
  * @return object
  */
 public static function getAll(Closure $callback = null)
 {
     $terms = Category::orderBy('id', 'desc');
     if ($callback) {
         $callback($terms);
     }
     return $terms->get();
 }
開發者ID:jacobcyl,項目名稱:writor,代碼行數:17,代碼來源:Category.php

示例10: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $pages = Category::orderBy('parent_id', 'ASC')->orderBy('category_order', 'ASC')->get()->toArray();
     $Tree = new Tree();
     $tree = $Tree->buildTree($pages);
     list($keys, $values) = array_divide($tree);
     return $values;
 }
開發者ID:Adamwaheed,項目名稱:safe,代碼行數:13,代碼來源:CategoryController.php

示例11: 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

示例12: boot

 /**
  * Bootstrap any application services.
  *
  * @return void
  */
 public function boot()
 {
     $categories = [];
     if (Schema::hasTable('categories')) {
         $categories = App\Category::orderBy('name')->get();
     }
     view()->share(compact('categories'));
 }
開發者ID:nickcoad,項目名稱:happy-lister,代碼行數:13,代碼來源:AppServiceProvider.php

示例13: edit

 public function edit($id)
 {
     $post = Post::where('id', $id)->first();
     $categories = Category::orderBy('name')->get();
     if (empty($post)) {
         return Redirect::route('administration.index');
     }
     return view('administration.blog.edit', ['post' => $post, 'categories' => $categories]);
 }
開發者ID:xchub,項目名稱:laravel-blog,代碼行數:9,代碼來源:BlogController.php

示例14: 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

示例15: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $categories = Category::orderBy('order')->get()->toArray();
     foreach ($categories as &$c) {
         $c['action'] = array('create' => Config::get('app.url') . '/category/' . $c['id'] . '/posts/create', 'view' => Config::get('app.url') . '/category/' . $c['id'] . '/posts');
     }
     $index = new Collection();
     $index['data'] = $categories;
     return response()->json($index);
 }
開發者ID:NCKU-Official,項目名稱:ncku-report-server,代碼行數:15,代碼來源:CategoryController.php


注:本文中的app\Category::orderBy方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。