我想为每日膳食列表创建每周视图

时间:2016-05-29 18:24:46

标签: php laravel

我正在使用Laravel 4.1,我在我的数据库'brunches'表中包含了全年的早午餐(365天= 365输入),现在我需要为我的早午餐创建每周视图。

我创建了一个日期列,所以我需要显示7天的用餐时间(例如:查看/周/ 8)。

$date1 =  Carbon::create(null, 1, 1, 0, 0, 0, 'Europe/Ljubljana');
$date2 =  Carbon::create(null, 1, 1, 0, 0, 0, 'Europe/Ljubljana');

$startDate = $date1->addDays(7 * $st);
$endDate = $date2->addDays((7 * $st)  + 1);
$brunches = DB::table('brunches')->where('datum', '>=', $startDate)->where('datum', '<', $endDate)->get();
return View::make('admin.teden')->with('brunches', $brunches)->with('st', $st);

但现在,如果我选择第一周,它会显示几天完全不同的日子,我想展示......你能帮助我吗? :)

0 个答案:

没有答案