Users ready
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* Customer: Theo Weijmer
|
||||
* Date: 21/12/2017
|
||||
* Time: 18:04
|
||||
*/
|
||||
|
||||
|
||||
class Customer extends BaseModel {
|
||||
|
||||
protected $table = "customers";
|
||||
|
||||
public static function getAllCustomers( $archive )
|
||||
{
|
||||
$customers = Customer::orderBy( 'name' );
|
||||
|
||||
if ( $archive == 'F' ) $customers = $customers->whereArchive( 'F' );
|
||||
|
||||
$customers = $customers->get();
|
||||
|
||||
return $customers;
|
||||
}
|
||||
|
||||
public static function saveCustomer( $customerID, $customer )
|
||||
{
|
||||
$customer = (array)$customer;
|
||||
|
||||
if( $customerID == 0)
|
||||
{
|
||||
$customer = Customer::create($customer);
|
||||
}
|
||||
else
|
||||
{
|
||||
$customer = Customer::whereId($customerID)->update($customer);
|
||||
}
|
||||
|
||||
return $customer['id'];
|
||||
}
|
||||
|
||||
public static function removeCustomer($customerID)
|
||||
{
|
||||
Customer::whereId($customerID)->delete();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user