We are working for update doc for SXIMO 5.1.7

Formating Post Value before insert to database

Sometime , before inserting value from post Form , we need to format the values . So how to replace and format value from post before adding them to database table ? You can call this as *BeforeAction* proccess . In every controller , they are exists funtion *postSave()* .This method is for handling database insert and update into database . Lets take a sample . we want to make sure , if user type they username in lowercase .

function postSave( $id =0)
{
	//.... code ... 
	if ($validator->passes()) {
		$data = $this->validatePost('users');
		// Replacement post value going here //
		$data['username'] = strtolower(Input::get('username'));
		// End replacement post value 		
		$ID = $this->model->insertRow($data , Input::get('userID'));
			
	}		
			
	//.... code ... 			
}