本文整理汇总了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'));
}
示例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'));
});
}