mirror of
https://github.com/slawkens/myaac.git
synced 2025-12-01 23:36:50 +01:00
Refactoring classes into src/ folder, so they will be auto-loaded by composer
This commit is contained in:
44
system/src/Data.php
Normal file
44
system/src/Data.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
/**
|
||||
* Data class
|
||||
*
|
||||
* @package MyAAC
|
||||
* @author Slawkens <slawkens@gmail.com>
|
||||
* @copyright 2019 MyAAC
|
||||
* @link https://my-aac.org
|
||||
*/
|
||||
|
||||
namespace MyAAC;
|
||||
|
||||
class Data
|
||||
{
|
||||
private $table = '';
|
||||
|
||||
public function __construct($table) {
|
||||
$this->table = $table;
|
||||
}
|
||||
|
||||
public function get($where)
|
||||
{
|
||||
global $db;
|
||||
return $db->select($this->table, $where);
|
||||
}
|
||||
|
||||
public function add($data)
|
||||
{
|
||||
global $db;
|
||||
return $db->insert($this->table, $data);
|
||||
}
|
||||
|
||||
public function delete($data, $where)
|
||||
{
|
||||
global $db;
|
||||
return $db->delete($this->table, $data, $where);
|
||||
}
|
||||
|
||||
public function update($data, $where)
|
||||
{
|
||||
global $db;
|
||||
return $db->update($this->table, $data, $where);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user