33 lines
775 B
PHP
33 lines
775 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use PDO;
|
|
|
|
/**
|
|
* Example user model
|
|
*
|
|
* PHP version 7.0
|
|
*/
|
|
class User extends \Core\Model
|
|
{
|
|
public $tableName = 'users';
|
|
|
|
/**
|
|
* Get all the users as an associative array
|
|
*
|
|
* @return array
|
|
*/
|
|
public function getAll() {
|
|
$db = static::getDB();
|
|
$stmt = $db->query('SELECT * FROM users');
|
|
return $stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
}
|
|
public function Insert($comment){
|
|
$db = static::getDB();
|
|
$stmt = $db->query(`insert into doc_comment('doc_id','child_id','content','time'') values (` + $comment["doc_id"] + `,` + $comment["child_id"] + `,` + $comment["content"] + `,` + $comment["time"] + `;`
|
|
);
|
|
return $stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
}
|
|
}
|