| Line 52... |
Line 52... |
| 52 |
public function add() {
|
52 |
public function add() {
|
| 53 |
if ($this->request->is('post')) {
|
53 |
if ($this->request->is('post')) {
|
| 54 |
$this->log(print_r($this->request->data,1),'devices');
|
54 |
$this->log(print_r($this->request->data,1),'devices');
|
| 55 |
$count = $this->Device->find('count',array('conditions'=>$this->request->data));
|
55 |
$count = $this->Device->find('count',array('conditions'=>$this->request->data));
|
| 56 |
if(!$count) {
|
56 |
if(!$count) {
|
| - |
|
57 |
$cachekey = 'webnotifications-'.$this->request->data['user_id'];
|
| - |
|
58 |
$activeNotifications = Cache::read($cachekey,$config = 'hour');
|
| - |
|
59 |
$this->log(print_r($activeNotifications,1),'checknotification');
|
| - |
|
60 |
if(!empty($activeNotifications)){
|
| - |
|
61 |
Cache::delete($cachekey, $config = 'hour');
|
| - |
|
62 |
}
|
| 57 |
$this->Device->create();
|
63 |
$this->Device->create();
|
| 58 |
if ($this->Device->save($this->request->data)) {
|
64 |
if ($this->Device->save($this->request->data)) {
|
| 59 |
$result = array('success'=>true,'message'=>__('Record Saved.'));
|
65 |
$result = array('success'=>true,'message'=>__('Record Saved.'));
|
| 60 |
} else {
|
66 |
} else {
|
| 61 |
$result = array('success'=>false,'message'=>print_r($this->Device->validationErrors,1));
|
67 |
$result = array('success'=>false,'message'=>print_r($this->Device->validationErrors,1));
|