BiFace_Server_Lite/models/CaptureLogs.php
2020-12-04 11:07:12 +07:00

73 lines
1.4 KiB
PHP

<?php
namespace app\models;
use Yii;
/**
* This is the model class for table "capture_logs".
*
* @property int $id
* @property int $staff_id
* @property int $time
* @property string $image
* @property int $status
* @property string $remark
*/
class CaptureLogs extends \yii\db\ActiveRecord {
/**
* {@inheritdoc}
*/
public static function tableName() {
return 'capture_logs';
}
/**
* {@inheritdoc}
*/
public function rules() {
return [
[['staff_id', 'time', 'status'], 'integer'],
[['image', 'remark'], 'string'],
];
}
/**
* {@inheritdoc}
*/
public function attributeLabels() {
return [
'id' => 'ID',
'time' => 'Time',
'image' => 'Image',
'status' => 'Status',
'remark' => 'Remark',
];
}
public function create($data) {
$r = $this->load([
'staff_id' => $data['Staff'],
'time' => $data['Time'],
'image' => $data["Image"],
'status' => 0,
'remark' => ''
], '');
if ($r) {
try {
$this->save();
return $this->id;
} catch (\Exception $ex) {
return false;
}
}
}
public static $statusArray = [
0 => "Unknown",
1 => "List management"
];
}