Offers
This commit is contained in:
@@ -29,41 +29,41 @@ class customersController extends MY_Controller {
|
||||
|
||||
public function getAllCustomers( $archive = 'F' )
|
||||
{
|
||||
$users = Customer::getAllCustomers( $archive );
|
||||
$customers = Customer::getAllCustomers( $archive );
|
||||
|
||||
$this->json( $users );
|
||||
$this->json( $customers );
|
||||
}
|
||||
|
||||
public function saveCustomer()
|
||||
{
|
||||
$userValidation = new CustomerValidation();
|
||||
$customerValidation = new CustomerValidation();
|
||||
|
||||
if ( ! $userValidation->getValidationResult() )
|
||||
if ( ! $customerValidation->getValidationResult() )
|
||||
return $this->json( [
|
||||
'success' => FALSE, 'messages' => $userValidation->getErrorMessages()] );
|
||||
'success' => FALSE, 'messages' => $customerValidation->getErrorMessages()] );
|
||||
|
||||
$user = $this->input->post();
|
||||
$customer = $this->input->post();
|
||||
|
||||
$userID = $user['id'];
|
||||
unset( $user['id'] );
|
||||
$customerID = $customer['id'];
|
||||
unset( $customer['id'] );
|
||||
|
||||
$userID = Customer::saveCustomer( $userID, $user );
|
||||
$customerID = Customer::saveCustomer( $customerID, $customer );
|
||||
|
||||
$this->json( ['success' => TRUE, 'userID' => $userID] );
|
||||
$this->json( ['success' => TRUE, 'customerID' => $customerID] );
|
||||
}
|
||||
|
||||
public function archiveCustomer( $userID, $status )
|
||||
public function archiveCustomer( $customerID, $status )
|
||||
{
|
||||
Customer::whereId( $userID )->update( ['archive' => $status] );
|
||||
Customer::whereId( $customerID )->update( ['archive' => $status] );
|
||||
}
|
||||
|
||||
public function removeCustomer( $userID )
|
||||
public function removeCustomer( $customerID )
|
||||
{
|
||||
$removeCustomer = new RemoveCustomer( $userID );
|
||||
$removeCustomer = new RemoveCustomer( $customerID );
|
||||
|
||||
if ( $removeCustomer->getAllowDelete() === FALSE ) return $this->json( ['result' => FALSE] );
|
||||
|
||||
Customer::removeCustomer( $userID );
|
||||
Customer::removeCustomer( $customerID );
|
||||
|
||||
$this->json( ['result' => TRUE] );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user