我的表:
员工
身份证 | 姓名
随着时间的推移
身份证 | total_day | 日期
加班_详情
身份证 | 加班时间_id | 员工_id | 支付
我的控制器:
public function details($id,$day)
{
$day = $d; // d -> day on buttons
$count = DB::table('overtime')
->select ('employee.name as employeename', 'overtime_details.payment as paymentemployee')
->join ('overtime_details', 'overtime_details.overtime_id', '=', 'overtime.id')
->join ('employee', 'employee.id', '=', 'overtime_details.employee_id')
->where ('day', $d)
->get();
// dd($count);
return view('countovertime.overtimedetails')->withCount($count);
}
当我使用dd, $count功能检查获得的数据时,它按我的预期正常工作,但是当dd关闭数据检查功能并返回查看页面选择第一天按钮时,页面显示为第一天员工加班,但是当第二天点击按钮时,页面仍然显示第一天的数据。
这是我的页面视图:
[Button day 1] [Button day 2] ->这个以加班“天”表为准
我的按钮控制器:
return DataTables::eloquent($model)
->addColumn('day', function(countovertime $st){
$links = '';
for ($d = 1; $h <= $st->day; $d++) {
$links .= ' <a href="overtimedetails/'. $st->id .'/'.$d.'" class="btn btn-danger btn-sm">Day-'. $d .'</a>';
}
return $links;
绝地无双
繁星点点滴滴