add admin edit ticket date
This commit is contained in:
43
backend/models/TicketUpdate.php
Normal file
43
backend/models/TicketUpdate.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
namespace backend\models;
|
||||
|
||||
|
||||
use common\models\Ticket;
|
||||
class TicketUpdate extends Ticket{
|
||||
|
||||
|
||||
public $startDate;
|
||||
public $endDate;
|
||||
|
||||
public $timestampStart;
|
||||
public $timestampEnd;
|
||||
|
||||
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
[['comment'], 'required'],
|
||||
[['comment'], 'string', 'max' => 255],
|
||||
[[ 'startDate','endDate' ], 'required'],
|
||||
[[ 'startDate', ], 'date' , 'timestampAttribute' => 'timestampStart' ,'timestampAttributeFormat' => 'yyyy-MM-dd' ],
|
||||
[[ 'endDate' , ], 'date' , 'timestampAttribute' => 'timestampEnd' ,'timestampAttributeFormat' => 'yyyy-MM-dd' ],
|
||||
[['status',], 'integer'],
|
||||
[['status',], 'in', 'range' => [ static ::STATUS_ACTIVE, static ::STATUS_INACTIVE ]],
|
||||
|
||||
];
|
||||
}
|
||||
|
||||
public function beforeSave($insert){
|
||||
if ( $insert ){
|
||||
return false;
|
||||
}
|
||||
if ( parent::beforeSave($insert)){
|
||||
$this->start = $this->startDate;
|
||||
$this->end = $this->endDate;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user