本文整理汇总了PHP中Product::orderBy方法的典型用法代码示例。如果您正苦于以下问题:PHP Product::orderBy方法的具体用法?PHP Product::orderBy怎么用?PHP Product::orderBy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Product
的用法示例。
在下文中一共展示了Product::orderBy方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getIndex
/**
* All Products
*/
public function getIndex()
{
// Page Title
$this->_data['page_title'] = "Products";
// Get All products
$this->_data['products'] = Product::orderBy('name', 'ASC')->get();
return View::make('admin.products.index', $this->_data)->nest('header', 'admin.common.header', $this->_data)->nest('footer', 'admin.common.footer', $this->_data);
}
示例2: display
public function display()
{
$products = Product::all();
$products = Product::orderBy('p_id', 'desc')->paginate(3);
$users = User::all();
$users = User::orderBy('id', 'desc')->paginate(3);
$suppliers = Product::lists('supplier', 'supplier');
$metals = Product::lists('metal', 'metal');
return View::make('products.list')->with('products', $products)->with('suppliers', $suppliers)->with('metals', $metals)->with('users', $users);
}
示例3: getIndex
/**
* Dashboard / All Transactions
*/
public function getIndex()
{
// Page Title
$this->_data['page_title'] = "Transactions";
$this->_data['affiliates'] = Affiliate::orderBy('name', 'ASC')->get();
$this->_data['products'] = Product::orderBy('name', 'ASC')->get();
$transactions = new Transaction();
$this->_data['transactions'] = $transactions->search();
$this->_data['searchParams'] = $transactions->getSearchParams();
$this->_data['revenue'] = $transactions->totalRevenue();
$this->_data['paidAffliates'] = $transactions->paidToAffiliates();
$this->_data['refundQueue'] = $transactions->refundQueueCount();
return View::make('admin.transactions.index', $this->_data)->nest('header', 'admin.common.header', $this->_data)->nest('footer', 'admin.common.footer', $this->_data);
}
示例4: getVideoIndex
/**
* View: Video Index
* @return Respanse
*/
public function getVideoIndex()
{
$articles = Article::orderBy('created_at', 'desc')->where('post_status', 'open')->paginate(6);
$travel = Travel::orderBy('created_at', 'desc')->where('post_status', 'open')->paginate(4);
$product = Product::orderBy('created_at', 'desc')->where('post_status', 'open')->where('quantity', '>', '0')->paginate(12);
$productCategories = ProductCategories::orderBy('sort_order')->where('cat_status', 'open')->get();
$job = Job::orderBy('created_at', 'desc')->where('post_status', 'open')->paginate(4);
$categories = Category::orderBy('sort_order')->where('cat_status', 'open')->get();
if (Auth::check()) {
$timeline = Timeline::orderBy('created_at', 'desc')->where('user_id', Auth::user()->id)->paginate(6);
} else {
$timeline = Timeline::orderBy('created_at', 'desc');
}
return View::make('home.videoindex')->with(compact('articles', 'categories', 'travel', 'product', 'productCategories', 'job', 'timeline'));
}
示例5: get
public function get($id = null)
{
$search = Input::get('search');
if (!is_null($search)) {
$suppliers = Supplier::withTrashed()->where('name', 'like', '%' . $search . '%')->orWhere('ruc', 'like', '%' . $search . '%')->orderBy('name')->paginate(15);
} else {
$suppliers = Supplier::withTrashed()->orderBy('name')->paginate(15);
}
$selectedSupplier = self::__checkExistence($id);
if (!$selectedSupplier) {
$selectedSupplier = new Supplier();
}
$allProducts = Product::orderBy('name')->get()->lists('name', 'id');
$selectedSupplierProducts = $selectedSupplier->products()->orderBy('name')->get()->toArray();
return View::make('suppliers.main')->with('id', $id)->with('allProducts', $allProducts)->with('selectedSupplierProducts', array_fetch($selectedSupplierProducts, 'id'))->with('selectedSupplier', $selectedSupplier)->with('search', $search)->with('suppliers', $suppliers);
}
示例6: fire
/**
* Execute the console command.
*
* @return mixed
*/
public function fire()
{
set_time_limit(0);
if (is_null($obj)) {
$product = new Product();
} else {
switch ($obj) {
case 'product':
$product = new Product();
break;
case 'page':
$product = new Page();
break;
case 'post':
$product = new Posts();
break;
default:
$product = new Product();
break;
}
}
$props = $product->orderBy('_id', 'desc')->get();
}
示例7: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
$items = Product::orderBy('name', 'ASC')->paginate(10);
return View::make('product.view_product', compact('items'));
}
示例8: getCardUpdateUrl
/**
* Card Update URL
*/
public function getCardUpdateUrl()
{
$this->_data['page_title'] = "Generate Card Update URL";
$this->_data['products'] = Product::orderBy('name', 'ASC')->get();
return View::make('admin.utilities.card-update-url', $this->_data)->nest('header', 'admin.common.header', $this->_data)->nest('footer', 'admin.common.footer', $this->_data);
}
示例9: products
public function products()
{
$catagory = Catagory::all();
$product = Product::orderBy('created_at', 'desc')->paginate(12);
return View::make('Products.Shop', array('catagories' => $catagory, 'products' => $product));
}
示例10: shop
public function shop()
{
$catagory = Catagory::all();
$product = Product::orderBy('created_at', 'desc')->get();
return View::make('users.shop', array('query' => $catagory, 'products' => $product));
}
示例11: search
public function search()
{
$search_year_ind = Utility::nvl(Input::get('search_year_ind'), 'All');
$input = urldecode(Input::get('search'));
if (!empty($input)) {
$searchTerms = explode(',', $input);
$query = Product::orderBy('workshop_year', 'desc')->orderBy('id', 'asc');
// Assign index 0 search terms directly...
$query->where('speaker_last_name', 'LIKE', '%' . $searchTerms[0] . '%')->orWhere('speaker_first_name', 'LIKE', '%' . $searchTerms[0] . '%')->orWhere('session_title', 'LIKE', '%' . $searchTerms[0] . '%');
foreach ($searchTerms as $key => $value) {
if ($key > 0) {
$query->orWhere('speaker_last_name', 'LIKE', '%' . $searchTerms[$key] . '%')->orWhere('speaker_first_name', 'LIKE', '%' . $searchTerms[$key] . '%')->orWhere('session_title', 'LIKE', '%' . $searchTerms[$key] . '%');
}
}
$current_workshop_year = Config::get('workshop.current_workshop_year');
if ($search_year_ind == 'Current') {
$query->where('workshop_year', '=', $current_workshop_year);
}
$results = $query->remember(5)->get();
//->paginate(20);
$message = "Search results for search criteria '" . $input . "'.";
ProductsController::makeIndexView($results, array('search_criteria' => $input, 'search_year_ind' => $search_year_ind, 'message' => $message));
}
}
示例12: fire
/**
* Execute the console command.
*
* @return mixed
*/
public function fire()
{
set_time_limit(0);
$obj = $this->argument('object');
if (is_null($obj)) {
$product = new Product();
} else {
switch ($obj) {
case 'product':
$product = new Product();
break;
case 'page':
$product = new Page();
break;
case 'post':
$product = new Posts();
break;
default:
$product = new Product();
break;
}
}
$props = $product->orderBy('_id', 'desc')->get();
//$seq = new Sequence();
$sizes = Config::get('picture.sizes');
$cnt = 1;
foreach ($props as $p) {
echo $cnt . "\n";
$cnt++;
echo $p->_id . "\n";
if (isset($p->files)) {
$files = $p->files;
foreach ($files as $folder => $files) {
$dir = public_path() . '/storage/media/' . $folder;
if (is_dir($dir) && file_exists($dir)) {
if ($dh = opendir($dir)) {
while (($file = readdir($dh)) !== false) {
if ($file != '.' && $file != '..') {
if (!preg_match('/^lrg_|med_|th_|full_|blob/', $file)) {
echo $dir . '/' . $file . "\n";
$destinationPath = $dir;
$filename = $file;
$urls = array();
foreach ($sizes as $k => $v) {
echo $destinationPath . '/' . $v['prefix'] . $filename . "\n";
if (file_exists($destinationPath . '/' . $v['prefix'] . $filename)) {
unlink($destinationPath . '/' . $v['prefix'] . $filename);
} else {
echo "file does not exist\n";
}
$thumbnail = Image::make($destinationPath . '/' . $filename)->fit($v['width'], $v['height'])->save($destinationPath . '/' . $v['prefix'] . $filename);
//print_r($thumbnail);
}
/*
$thumbnail = Image::make($destinationPath.'/'.$filename)
->fit( $sizes['thumbnail']['width'] ,$sizes['thumbnail']['height'])
->save($destinationPath.'/th_'.$filename);
$medium = Image::make($destinationPath.'/'.$filename)
->fit( $sizes['medium']['width'] ,$sizes['medium']['height'])
->save($destinationPath.'/med_'.$filename);
$large = Image::make($destinationPath.'/'.$filename)
->fit( $sizes['large']['width'] ,$sizes['large']['height'])
->save($destinationPath.'/lrg_'.$filename);
$full = Image::make($destinationPath.'/'.$filename)
->fit( $sizes['full']['width'] ,$sizes['full']['height'])
->save($destinationPath.'/full_'.$filename);
*/
}
}
}
closedir($dh);
}
}
}
}
}
}
示例13: getIndex
public function getIndex()
{
$products = Product::orderBy('created_at', 'DESC')->paginate(4);
return View::make('store.index')->with('products', $products);
}
示例14: getIndex
public function getIndex()
{
$data = array('products' => Product::orderBy('id', 'DESC')->paginate(5));
return View::make('admin.product.index', $data);
}
示例15: listProducts
public function listProducts()
{
$products = Product::orderBy('code')->get();
return View::make("product", array("products" => $products));
}