public function validateDoubleDoctor($attribute, $params)
 {
     $validatequery = Trreservation::findOne(['Date' => $this->Date, 'DoctorID' => $this->DoctorID]);
     if ($validatequery && $validatequery->ReservationID != $this->ReservationID) {
         $this->addError($attribute, 'The Doctor has another booking in this time.');
     }
 }
 /**
  * Finds the Trreservation model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Trreservation the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Trreservation::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
예제 #3
0
<?php

use yii\helpers\Html;
use app\models\Trreservation;
$events = array();
$kalender = Trreservation::findOne(26);
//Testing
$Event = new \yii2fullcalendar\models\Event();
$Event->id = 1;
$Event->title = 'Booked Schedule';
$Event->start = date('Y-m-d\\TH:m:s\\Z');
$events[] = $Event;
$Event = new \yii2fullcalendar\models\Event();
$Event->id = 2;
$Event->title = 'Booked Schedule';
$Event->start = date('Y-m-d\\TH:m:s\\Z', strtotime('tomorrow 6am'));
$events[] = $Event;
foreach ($querytest as $hasil) {
    $Event = new \yii2fullcalendar\models\Event();
    $Event->id = $hasil->ReservationID;
    $Event->title = 'Booked Schedule';
    $Event->start = $hasil->Date;
    $events[] = $Event;
}
?>

  <p><?php 
echo Html::encode($kalender->Date);
?>
</p>