recent_employees =DB::table('users.created_at')
->join('employees', 'users.id', '=', 'employees.user_id')
->select('users.id', 'name','created_at')
->where DATE_SUB(CURDATE(),INTERVAL 30 DAY) <= 'created_at';
->get();
Try this
recent_employees =DB::table('users as u') ->join('employees as e', 'users.id', '=', 'employees.user_id')
->select('u.id', 'e.name','u.created_at')
->whereRaw('DATE_SUB(CURDATE(),INTERVAL 30 DAY) <= 'created_at')
->get();
$date = date("Y-m-d");// current date
$dates = date("Y-m-d", strtotime(date("Y-m-d", strtotime($date)) . " -1
month"));
$count_student = DB::table('students')->count();
$recent_students =DB::table('users')
->join('students', 'users.id', '=', 'students.user_id')
/*->select('users.id', 'name','users.created_at')*/
->where('created_at', ">=", $dates)
->get();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.