public function ngRestConfig($config)
 {
     $config->aw->load(['class' => 'luya\\admin\\aws\\Gallery', 'refTableName' => 'gallery_album_image', 'imageIdFieldName' => 'image_id', 'refFieldName' => 'album_id', 'alias' => Module::t('album_upload')]);
     $this->ngRestConfigDefine($config, 'list', ['title', 'sort_index', 'is_highlight', 'cover_image_id']);
     $this->ngRestConfigDefine($config, ['create', 'update'], ['cat_id', 'title', 'description', 'cover_image_id', 'sort_index', 'is_highlight']);
     $config->delete = true;
     return $config;
 }
Exemple #2
0
 public function eventBeforeDelete($event)
 {
     $items = Album::find()->where(['cat_id' => $this->id])->all();
     if (count($items) > 0) {
         $this->addError('id', Module::t('cat_delete_error'));
         $event->isValid = false;
         return;
     }
     $event->isValid = true;
 }