update api open door

This commit is contained in:
2022-10-18 08:38:54 +07:00
parent d6d7dc3719
commit c8e0bb7795
4 changed files with 103 additions and 4 deletions

View File

@@ -14,6 +14,7 @@ use Yii;
* @property string $from_date
* @property string $to_date
* @property string $date_of_week
* @property int $id_door_calendar
*/
class Schedule extends \yii\db\ActiveRecord {
@@ -30,6 +31,7 @@ class Schedule extends \yii\db\ActiveRecord {
public function rules() {
return [
[['staff_id', 'from_time', 'to_time', 'from_date', 'to_date', 'date_of_week'], 'string'],
[['id_door_calendar'], 'integer'],
];
}
@@ -45,6 +47,7 @@ class Schedule extends \yii\db\ActiveRecord {
'from_date' => 'From Date',
'to_date' => 'To Date',
'date_of_week' => 'Date Of Week',
'id_door_calendar' => 'id_door_calendar'
];
}
@@ -56,12 +59,13 @@ class Schedule extends \yii\db\ActiveRecord {
public function create($data) {
$r = $this->load([
'staff_id' => $data['staff_id'],
'staff_id' => strval($data['staff_id']),
'from_time' => $data['from_time'],
'to_time' => $data['to_time'],
'from_date' => $data['from_date'],
'to_date' => $data['to_date'],
'date_of_week' => $data['date_of_week']
'date_of_week' => $data['date_of_week'],
'id_door_calendar' => $data['id_door_calendar']
], '');
if ($r) {
try {