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