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


PHP Item::orderby方法代码示例

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


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

示例1: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $items = Item::orderby('created_at', 'DESC')->paginate(PAGINATE);
     return view('admin.items.index')->with(compact('items'));
 }
开发者ID:louisthaihv,项目名称:colong,代码行数:10,代码来源:ItemController.php

示例2: boot

 /**
  * Bootstrap the application services.
  *
  * @return void
  */
 public function boot()
 {
     // itemList
     view()->composer(array('bomitems.createitem', 'bomitems.edit', 'sales.soitems.create', 'sales.soitems.edit'), function ($view) {
         $view->with('itemList', \App\Item::orderby('id', 'asc')->lists('item_number', 'id'));
     });
     // itemclassList
     view()->composer(array('items.create', 'items.edit'), function ($view) {
         $view->with('itemclassList', \App\Itemclass::orderby('id', 'asc')->lists('name', 'id'));
     });
     // itemtypeList
     view()->composer(array('items.create', 'items.edit'), function ($view) {
         $view->with('itemtypeList', \App\Itemtype::orderby('id', 'asc')->lists('name', 'id'));
     });
     // provinceList
     view()->composer(array('addr.citys.create', 'addr.citys.edit', 'addr.addrs.create', 'addr.addrs.edit'), function ($view) {
         $view->with('provinceList', \App\Province::orderby('id', 'asc')->lists('name', 'id'));
     });
     // cityList
     view()->composer(array('addr.addrs.create', 'addr.addrs.edit'), function ($view) {
         $view->with('cityList', \App\City::orderby('id', 'asc')->lists('name', 'id'));
     });
     // addrList
     view()->composer(array('contacts.create', 'contacts.edit', 'inventory.warehouses.create', 'inventory.warehouses.edit', 'purchase.vendinfos.create', 'purchase.vendinfos.edit'), function ($view) {
         $view->with('addrList', \App\Addr::orderby('id', 'asc')->lists('line1', 'id'));
     });
     // contactList
     view()->composer(array('custinfos.create', 'custinfos.edit', 'inventory.warehouses.create', 'inventory.warehouses.edit', 'purchase.vendinfos.create', 'purchase.vendinfos.edit', 'purchase.purchaseorders.create', 'purchase.purchaseorders.edit'), function ($view) {
         $view->with('contactList', \App\Contact::orderby('id', 'asc')->lists('name', 'id'));
     });
     // deptList
     view()->composer(array('system.employees.create', 'system.employees.edit'), function ($view) {
         $view->with('deptList', \App\System\Dept::orderby('id', 'asc')->lists('name', 'id'));
     });
     // imageList
     view()->composer(array('system.employees.create', 'system.employees.edit'), function ($view) {
         $view->with('imageList', \App\System\Image::orderby('id', 'asc')->lists('name', 'id'));
     });
     // custinfoList
     view()->composer(array('sales.salesorders.create', 'sales.salesorders.edit'), function ($view) {
         $view->with('custinfoList', \App\Custinfo::orderby('id', 'asc')->lists('name', 'id'));
     });
     // salesrepList
     view()->composer(array('sales.salesorders.create', 'sales.salesorders.edit'), function ($view) {
         $view->with('salesrepList', \App\Sales\Salesrep::orderby('id', 'asc')->lists('name', 'id'));
     });
     // termList
     view()->composer(array('purchase.vendinfos.create', 'purchase.vendinfos.edit', 'purchase.purchaseorders.create', 'purchase.purchaseorders.edit'), function ($view) {
         $view->with('termList', \App\Sales\Term::orderby('id', 'asc')->lists('code', 'id'));
     });
     // vendtypeList
     view()->composer(array('purchase.vendinfos.create', 'purchase.vendinfos.edit'), function ($view) {
         $view->with('vendtypeList', \App\Purchase\Vendtype::orderby('id', 'asc')->lists('code', 'id'));
     });
     // vendinfoList
     view()->composer(array('purchase.purchaseorders.create', 'purchase.purchaseorders.edit'), function ($view) {
         $view->with('vendinfoList', \App\Purchase\Vendinfo::orderby('id', 'asc')->lists('number', 'id'));
     });
     // soheadList
     view()->composer(array('purchase.purchaseorders.create', 'purchase.purchaseorders.edit'), function ($view) {
         $view->with('soheadList', \App\Sales\Salesorder::orderby('id', 'asc')->lists('number', 'id'));
     });
     // itemsiteList
     view()->composer(array('purchase.poitems.create', 'purchase.poitems.edit'), function ($view) {
         //             $items = \App\Inventory\Itemsite::orderby('itemsites.id', 'asc')->leftJoin('items', 'itemsites.item_id', '=', 'items.id')->select('item_number', 'itemsites.id')->get();
         $view->with('itemsiteList', \App\Inventory\Itemsite::orderby('itemsites.id', 'asc')->leftJoin('items', 'itemsites.item_id', '=', 'items.id')->select('item_number', 'itemsites.id')->lists('item_number', 'id'));
         //             $view->with('itemsiteList', DB::table('itemsites')->leftJoin('items', 'itemsites.item_id', '=', 'items.id')->select('item_number', 'itemsites.id')->lists('item_number', 'itemsites.id'));
         //             $view->with('itemsiteList', \App\Inventory\Itemsite::orderby('itemsites.id', 'asc')->lists('item_id', 'id'));
     });
     // roleList
     view()->composer(array('system.users.editrole'), function ($view) {
         $view->with('roleList', \App\Role::orderby('id', 'asc')->lists('name', 'id'));
     });
     // charIList: item char list
     view()->composer(array('items.create', 'items.edit'), function ($view) {
         $view->with('charIList', \App\Product\Characteristic::orderby('id', 'asc')->where('bitems', true)->lists('name', 'id'));
     });
 }
开发者ID:seahouse,项目名称:la514test,代码行数:83,代码来源:ViewComposerServiceProvider.php


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