Skip to content

Instantly share code, notes, and snippets.

@rajithwijepura
Created April 24, 2016 15:02
Show Gist options
  • Save rajithwijepura/813a8008952618bcf0764b3800679008 to your computer and use it in GitHub Desktop.
Save rajithwijepura/813a8008952618bcf0764b3800679008 to your computer and use it in GitHub Desktop.
KC inactive users
/**
* Show electricians which have not sent coupons for 2 year
* @return void
*/
public function inactive() {
$time = new Time('2 years ago');
$electricians = $this->Electricians->find('all', [
'conditions' => [
'Electricians.is_deleted' => 0,
'Electricians.is_blocked' => 0,
'Electricians.is_authorised' => 1,
'Electricians.last_coupon_update_date <' => $time->format('Y-m-d')
],
'contain' => ['UserTypes', 'ProductSalesAreas', 'AreaCodes', 'Districts'],
'order' => ['Electricians.electrician_id' => 'ASC']
]);
$this->set(compact('electricians'));
$this->set('_serialize', ['electricians']);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment