Iam trying to save value '1' to the 'profile_created' field of my user table when the currently logged in user creates/adds a profile, my current implementation doesnt change this value, any suggestions? Thanks in advance.
Current profile adding code:
public function add() {
if ($this->request->is('post')) {
$this->Profile->create();
$this->request->data['Profile']['user_id'] = $this->Auth->user('id');
// code implemented below
$this->loadModel('User');
$data = array(
'Profile' => array('user_id' => $this->Auth->user('id')),
'User' => array('profile_created' => '1'),
);
if ($this->Profile->saveAssociated($this->request->data)) {
$this->Session->setFlash(__('Your account profile has been created'));
$this->redirect(array('controller' => 'events', 'action' => 'index'));
} else {
$this->Session->setFlash(__('Your account profile could not be saved. Please, try again.'));
}
}
}