【发布时间】:2015-04-25 22:38:18
【问题描述】:
我正在使用 laravel。在我的控制器中,我使用了一个查询(如下所示)。是否有任何修改过的查询?还是没事???
$sub = Studentacademicinfo::where('class','=',$cat)->where('section','=',$section)->get();
【问题讨论】:
我正在使用 laravel。在我的控制器中,我使用了一个查询(如下所示)。是否有任何修改过的查询?还是没事???
$sub = Studentacademicinfo::where('class','=',$cat)->where('section','=',$section)->get();
【问题讨论】:
如果你想整理代码,你可以这样做:
$sub = Studentacademicinfo::whereClass($cat)->whereSection($section)->get();
但生成的 SQL 将是相同的
【讨论】: