本文整理汇总了PHP中app\Topic::orderBy方法的典型用法代码示例。如果您正苦于以下问题:PHP Topic::orderBy方法的具体用法?PHP Topic::orderBy怎么用?PHP Topic::orderBy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Topic
的用法示例。
在下文中一共展示了Topic::orderBy方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index(Request $request)
{
$topics = Topic::orderBy('status', 'asc')->orderBy('sorter', 'desc')->get();
if ($request->format() != 'html') {
return $topics;
} else {
return view('topic.index', ['topics' => $topics]);
}
}
示例2: menuList
public function menuList(Request $request)
{
// $classes = Video::distinct()->groupBy('class')->get();
// //$topicsList = Video::distinct()->groupBy('topic')->get();
// //$topicsList = Topic::distinct()->groupBy('course')->orderBy('priority','ASC')->get();
// $topicsList = Video::join('topics',function($join){
// $join->on('videos.topic','=','topics.topic')->On('videos.class','=','topics.course');
// })->groupBy('topics.topic')->orderBy('priority', 'ASC')->get();
// $menuList = Video::get();
// $videos = Video::where('instructor','like', $squery)->orWhere('title', 'like', $squery)->orWhere('class', 'like', $squery)->orderBy('id', 'DESC')->paginate(15);
// $data = Video::join('topics',function($join){
// $join->on('videos.class','=','topics.course') ->on('videos.unit','=','topics.unit');
// })->groupBy('topics.course')->orderBy('priority', 'ASC')->get();
$data = Video::orderBy('order', 'ASC')->get();
$classes = Video::distinct()->groupBy('class')->get();
$menuList = Topic::orderBy('priority', 'ASC')->get();
return view('videos.menu', compact('menuList', 'classes', 'data'));
//return view('videos.menu', compact('videos'))->with('search', $search);
//return view('videos.menu');
}
示例3: index
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
$topics = Topic::orderBy('updated_at', 'desc')->paginate(24);
return view('topics.index', compact('topics'));
}
示例4: allChannel
public function allChannel()
{
return view('webboard', ['latestTopic' => 'latest topic', 'topics' => Topic::orderBy('created_at')->paginate(config('app.frontEnd.topic.per_page')), 'channels' => Channel::all(), 'user' => Auth::user()]);
}
示例5: edit
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return Response
*/
public function edit($video)
{
$units = Topic::orderBy('priority', 'ASC')->get();
$topics = Video::distinct()->select(['class', 'topic'])->orderBy('class', 'ASC')->get();
return view('videos.edit', compact('video', 'units', 'topics'));
}
示例6: index
/**
* Display all topics
* @return \Illuminate\View\View
*/
public function index()
{
$topics = Topic::orderBy('title', 'asc')->get();
return view('topics.index', compact('topics'));
}