当前位置: 首页>>代码示例>>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;未经允许,请勿转载。