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


PHP Type::orderBy方法代码示例

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


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

示例1: __construct

 public function __construct(Reservation $reservation)
 {
     $this->reservation = $reservation;
     View::share('locations', Location::orderBy('name', 'asc')->get());
     View::share('types', Type::orderBy('name', 'asc')->get());
     View::share('news', Post::where('post_type', 'news')->orderBy('created_at', 'desc')->limit(4)->get());
 }
开发者ID:jacobDaeHyung,项目名称:Laravel-Real-Estate-Manager,代码行数:7,代码来源:PropertyController.php

示例2: getIndex

 public function getIndex()
 {
     $key = Input::get('search');
     if (isset($key)) {
         $data = Type::where('name', 'like', '%' . $key . '%')->orderBy('id', 'desc')->paginate(10);
     } else {
         $data = Type::orderBy('id', 'desc')->paginate(10);
     }
     return View::make('home/dashboard', array())->nest('content', 'Type/index', array('data' => $data));
 }
开发者ID:andrinda,项目名称:myhotel,代码行数:10,代码来源:TypeController.php

示例3: __construct

 public function __construct()
 {
     View::share('page_title', 'Client');
     View::share('locations', Location::orderBy('name', 'asc')->get());
     View::share('types', Type::orderBy('name', 'asc')->get());
     View::share('news', Post::where('post_type', 'news')->orderBy('created_at', 'desc')->limit(4)->get());
     if (Sentry::check()) {
         View::share('user', Sentry::getUser());
         $this->user = Sentry::getUser();
     }
 }
开发者ID:jacobDaeHyung,项目名称:Laravel-Real-Estate-Manager,代码行数:11,代码来源:PublicClientsController.php

示例4: dropdown

 public static function dropdown($novalue = null)
 {
     $locations = Type::orderBy('name')->get();
     $array = array();
     if ($novalue) {
         $array = array('' => 'Any');
     }
     foreach ($locations as $l) {
         $key = $l->id;
         $array[$key] = ucwords($l->name);
     }
     return $array;
 }
开发者ID:jacobDaeHyung,项目名称:Laravel-Real-Estate-Manager,代码行数:13,代码来源:Type.php

示例5: getTypes

 public static function getTypes()
 {
     $arrData = [];
     if (Cache::has('types')) {
         $arrData = Cache::get('types');
     } else {
         $types = Type::orderBy('order_no')->get();
         $arrData = [];
         if (!$types->isEmpty()) {
             $arrData = $types->toArray();
         }
         Cache::forever('types', $arrData);
     }
     return $arrData;
 }
开发者ID:nguyendaivu,项目名称:imagestock,代码行数:15,代码来源:Home.php

示例6: getContent

 public function getContent($type_id = 'content', $id = 'edit')
 {
     if ($type_id == 'content' && $id == 'edit') {
         $posts = Type::orderBy('created_at', 'desc')->get();
         return View::make('admin.content')->with('posts', $posts);
     }
     $posts = Post::where('type_id', '=', $type_id)->where('parent', '=', '0')->orderBy('created_at', 'desc')->get();
     $posts_child = Post::where('type_id', '=', $type_id)->where('parent', '!=', '0')->orderBy('created_at', 'desc')->get();
     $view = array('posts' => $posts, 'posts_child' => $posts_child, 'type_id' => $type_id);
     $templates = array('page' => 'Текст', 'gallery' => 'Галерея');
     //добавляем категорию
     if ($type_id == 'type' && $id == 'add') {
         $view['templates'] = $templates;
         return View::make('admin.post-type', $view);
     }
     //редактируем категорию
     if ($id == 'edit') {
         $post = Type::where('id', $type_id)->first();
         $view['row'] = $post;
         $view['templates'] = $templates;
         return View::make('admin.post-type', $view);
     } else {
         if (is_numeric($id) || $id == 'add') {
             $post = Post::find($id);
             $galleries = Gallery::where('post_id', $id)->get();
             $parent[0] = '';
             foreach ($posts as $value) {
                 if ($value->id != $id) {
                     $parent[$value['id']] = $value['name'];
                 }
             }
             $view['galleries'] = $galleries;
             $view['parent'] = $parent;
             $view['row'] = $post;
             return View::make('admin.posts', $view);
         }
     }
 }
开发者ID:ldin,项目名称:project_kartinki,代码行数:38,代码来源:AdminController.php


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