當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Quote::orderBy方法代碼示例

本文整理匯總了PHP中Quote::orderBy方法的典型用法代碼示例。如果您正苦於以下問題:PHP Quote::orderBy方法的具體用法?PHP Quote::orderBy怎麽用?PHP Quote::orderBy使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Quote的用法示例。


在下文中一共展示了Quote::orderBy方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getMain

 public function getMain()
 {
     $moderatequotes = Quote::orderBy('id', 'desc')->whereStatus(0);
     $quotes = Auth::user()->quotes()->orderBy('id', 'desc')->paginate(Config::get('settings.per_page'));
     $this->layout->title = 'Dashboard';
     $this->layout->nest('content', 'user.dashboard.main', ['quotes' => $quotes, 'moderatequotes' => $moderatequotes]);
 }
開發者ID:shiftosnext,項目名稱:Quotinator,代碼行數:7,代碼來源:UserDashboardController.php

示例2: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     if (!Input::has('sp')) {
         $sp = 0;
     } else {
         $sp = intval(Input::get('sp'));
     }
     return Response::json(['sp' => intval($sp) + 10, 'quotes' => Quote::orderBy('created_at', 'desc')->skip($sp)->take(10)->get()]);
 }
開發者ID:elvisjames,項目名稱:oneline,代碼行數:14,代碼來源:QuoteController.php

示例3: getSearch

 public function getSearch()
 {
     if (Session::has('search')) {
         $words = explode(' ', Session::get('search'));
         $quotes = Quote::orderBy('id', 'desc')->orWhere(function ($query) use($words) {
             foreach ($words as $word) {
                 $query->where('quote', 'LIKE', '%' . $word . '%');
             }
             $query->whereStatus(1);
         })->orWhere(function ($query) use($words) {
             foreach ($words as $word) {
                 $query->where('title', 'LIKE', '%' . $word . '%');
             }
             $query->whereStatus(1);
         })->paginate(Config::get('settings.per_page'));
         $quotesCount = $quotes->count();
         //$this->layout->title = 'Search';
         $this->layout->nest('content', 'search', ['quotes' => $quotes, 'count' => $quotesCount, 'terms' => Session::get('search')]);
     } else {
         return Redirect::to('/')->withErrors(array('usesearch' => 'Use the search box, silly :)'));
     }
 }
開發者ID:shiftosnext,項目名稱:Quotinator,代碼行數:22,代碼來源:HomeController.php


注:本文中的Quote::orderBy方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。