如何用laravel编写此查询?
我需要在拉威尔的这个查询的帮助如何用laravel编写此查询?,laravel,Laravel,我需要在拉威尔的这个查询的帮助 $forums=\DB::select('select*FROM forums 其中类别='.$f.&& (community=“”.$c.“|| community=“xx”) 按id ASC')订购; 但我怎么能和拉威尔·西塔斯特写这篇文章呢? $forums=forums::where()默认情况下,Laravel假设数据库表是模型名称的复数形式。 我认为你的模式是论坛而不是论坛 试试这个: $forums = Forum::where("cat
$forums=\DB::select('select*FROM forums
其中类别='.$f.&&
(community=“”.$c.“|| community=“xx”)
按id ASC')订购;
但我怎么能和拉威尔·西塔斯特写这篇文章呢?
$forums=forums::where()
默认情况下,Laravel假设数据库表是模型名称的复数形式。
我认为你的模式是论坛
而不是论坛
试试这个:
$forums = Forum::where("category", $f)
->where(function($query) use($c) {
$query->where("community", $c)
->orWhere("community", "xx");
})
->orderBy("id", "ASC")
->get();
默认情况下,Laravel假定数据库表是模型名称的复数形式。 我认为你的模式是
论坛
而不是论坛
试试这个:
$forums = Forum::where("category", $f)
->where(function($query) use($c) {
$query->where("community", $c)
->orWhere("community", "xx");
})
->orderBy("id", "ASC")
->get();
这样试试
$forums = Forum::where("category", $f)
->where(function($query) use($c) {
$query->where("community", $c)
->orWhere("community", "xx");
})
->orderBy("id", "ASC")
->get();
这样试试
$forums = Forum::where("category", $f)
->where(function($query) use($c) {
$query->where("community", $c)
->orWhere("community", "xx");
})
->orderBy("id", "ASC")
->get();