【发布时间】:2018-03-27 09:07:16
【问题描述】:
我正在使用 Laravel 5.5。
我有表 centrals 和模型 Centrals
和这样的桌子
我的控制器
$from = $request->year_from;
$to = $request->year_to;
$month_from = $request->month_from;
$month_to = $request->month_to;
$param = $request->get('parameters_id', []);
$search = Centrals::whereIn('parameters_id', $param)
->where('type', 'Monthly')
->where('year', $from)
->whereBetween('months_id', [$month_from, $month_to])
->orderBy('year')
->get();
现在我如何获取数据 示例请求:
$request->year_from = 2016;
$request->month_from = 1; /* 1 =Jan*/
$request->year_from = 2018;
$request->month_from = 3; /* 3 =Mar*/
【问题讨论】:
标签: php laravel laravel-5 controller eloquent