예제 #1
0
 protected function findModel($id)
 {
     if (($model = Product::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
예제 #2
0
 public function beforeDelete()
 {
     if (parent::beforeDelete()) {
         CategoryDetail::deleteAll(['category_id' => $this->id]);
         Product::deleteAll(['category_id' => $this->id]);
         return true;
     } else {
         return false;
     }
 }