Users ready
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 15/12/2017
|
||||
* Time: 19:37
|
||||
*/
|
||||
|
||||
class Customer_model extends MY_Model {
|
||||
|
||||
protected $tablename = "customers";
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -28,7 +28,7 @@ class User_model extends MY_Model {
|
||||
$this->sql = "
|
||||
SELECT *
|
||||
FROM users
|
||||
WHERE ucase( {$field} ) = '{strtoupper($fieldValue)}'
|
||||
WHERE ucase( {$field} ) = '".strtoupper($fieldValue)."'
|
||||
AND id != {$recordID} ";
|
||||
|
||||
$result = $this->get_query_row();
|
||||
|
||||
@@ -27,7 +27,7 @@ class BaseModel extends Eloquent {
|
||||
|
||||
protected $guarded = [];
|
||||
|
||||
protected $hidden = ['creation_date', 'last_update_date', 'created_by', 'updated_by'];
|
||||
protected $hidden = ['creation_date', 'last_update_date', 'created_by', 'updated_by', 'password', 'salt'];
|
||||
|
||||
protected static $oldValue;
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -47,18 +47,23 @@ class User extends BaseModel {
|
||||
|
||||
public static function saveUser( $userID, $user )
|
||||
{
|
||||
$user = (array)$user;
|
||||
|
||||
if( $userID == 0)
|
||||
{
|
||||
$user = User::create($user);
|
||||
}
|
||||
else
|
||||
{
|
||||
$user = User::whereId($userID);
|
||||
|
||||
$user->update($user);
|
||||
$user = User::whereId($userID)->update($user);
|
||||
}
|
||||
|
||||
return $user->id;
|
||||
return $user['id'];
|
||||
}
|
||||
|
||||
public static function removeUser($userID)
|
||||
{
|
||||
User::whereId($userID)->delete();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user