예제 #1
0
 protected function toImage(Battle $battle, $imageTypeId, $attr)
 {
     if ($this->isTest) {
         return null;
     }
     if ($this->{$attr} == '' && !$this->{$attr} instanceof UploadedFile) {
         return null;
     }
     $o = new BattleImage();
     $o->battle_id = $battle->id;
     $o->type_id = $imageTypeId;
     $o->filename = BattleImage::generateFilename();
     return $o;
 }