Skip to content

Instantly share code, notes, and snippets.

@jagroop
Last active November 17, 2017 09:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jagroop/37a06d4e837ea4d826754f87a91769e5 to your computer and use it in GitHub Desktop.
Save jagroop/37a06d4e837ea4d826754f87a91769e5 to your computer and use it in GitHub Desktop.
Cron jobs Logics
<?php
// 3:30 AM Cron job
public function threeAMCron()
{
$this->db->where_in('id', [14, 60]);
$this->db->where("date_format(CONVERT_TZ(NOW(), 'UTC', local_tz), '%H:%i') = '15:30'");
$users = $this->db->get('users')->result();
$this->load->library('notification');
foreach ($users as $key => $user) {
$this->notification->send($user, [
'from_id' => $user->id,
'message' => "2 PM Notification test, please take a screen shot.",
'type' => 'inactive_trackee'
]);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment