app/Api/V1/Controllers/GoodController.php
/**
     * upload pictures from zip and link to goods through the names in array
     *
     * @param array $tempPictures
     * @param array $picturesArray
     * @param Good $good
     */
upload pictures from zip and link to goods through the names in array
@param array $tempPictures
@param array $picturesArray
@param Good $good
upload pictures from zip and link to goods through the names in array @param array $tempPictures @param array $picturesArray @param Good $good
protected function attachPictureArrayGoods($tempPictures, array $picturesArray, $good)
    {
        $finfo = new \finfo(FILEINFO_MIME_TYPE);
        foreach ($picturesArray as $picture) {
            try {
                $filePath = $this->getTempFile($picture);
                if (in_array($picture, $tempPictures)) {
                    $image = new UploadedFile(
                        $filePath,
                        $picture, $finfo->file($filePath),
                        null, null, true);
                    $good->attachPictures($image, $good->name, 'goods');
                }
            } catch (Exception $e) {
            }
        }
    }
protected function attachPictureArrayGoods ( $ tempPictures , array $ picturesArray , $ good ) { $ finfo = new \ finfo ( FILEINFO_MIME_TYPE ) ; foreach ( $ picturesArray as $ picture ) { try { $ filePath = $ this -> getTempFile ( $ picture ) ; if ( in_array ( $ picture , $ tempPictures ) ) { $ image = new UploadedFile ( $ filePath , $ picture , $ finfo -> file ( $ filePath ) , null , null , true ) ; $ good -> attachPictures ( $ image , $ good -> name , 'goods' ) ; } } catch ( Exception $ e ) { } } }
upload pictures from zip and link to goods through the names in array
 @param array $tempPictures
 @param array $picturesArray
 @param Good $good
upload pictures from zip and link to goods through the names in array @param array $tempPictures @param array $picturesArray @param Good $good
//attach picture to good //do nothing