当前位置: 首页>>代码示例>>PHP>>正文


PHP Photo::delete方法代码示例

本文整理汇总了PHP中app\Photo::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Photo::delete方法的具体用法?PHP Photo::delete怎么用?PHP Photo::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\Photo的用法示例。


在下文中一共展示了Photo::delete方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: destroy

 public function destroy($year, $month, $day)
 {
     $date = $this->createDate($year, $month, $day);
     $photo = new Photo($date);
     if ($photo->exists() === false) {
         abort(404);
     }
     $photo->delete();
     return response()->json($photo);
 }
开发者ID:simondubois,项目名称:photos,代码行数:10,代码来源:PhotoController.php

示例2: multiple_upload

 public function multiple_upload(Request $request)
 {
     /*
      * Tests incoming files to make sure there's no duplicates in db
      */
     // getting all of the post data
     $files = Input::file('userfile');
     // Making counting of uploaded images
     $file_count = count($files);
     // start count how many uploaded
     $uploadcount = 0;
     $hash_type = 'md5';
     // don't change this on an existing database!
     $filepath = 'img/';
     $thumbpath = 'img/thumbs/';
     foreach ($files as $file) {
         if (in_array(exif_imagetype($file), array(IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG))) {
             $filename = $file->getClientOriginalName();
             $extension = strtolower($file->getClientOriginalExtension());
             $photo = new Photo();
             //photo db object
             $photo->filename = $filename;
             $photo->extension = $extension;
             $photo->save();
             $currImg = Image::make($file);
             $currFilePath = $filepath . $photo->id . "." . $extension;
             $currImg->orientate()->save($currFilePath);
             // saving the actual file
             $hashcheck = hash_file($hash_type, $currFilePath);
             $hasDuplicate = Photo::where('hash', $hashcheck)->first();
             if ($hasDuplicate) {
                 // rollback if duplicate found
                 File::delete($currFilePath);
                 $photo->delete();
             } else {
                 $currImg->heighten(174)->save($thumbpath . $photo->id . "_thumb" . "." . $extension);
                 $photo->hash = hash_file($hash_type, $currFilePath);
                 // hash generated after we save the file
                 $photo->notes = $request->input('note');
                 $photo->image_subject = "Rosemary";
                 $photo->save();
                 $uploadcount++;
             }
             $currImg->destroy();
             // free up memory
         }
     }
     return $file_count - $uploadcount;
 }
开发者ID:AlecHansen,项目名称:imageshare,代码行数:49,代码来源:PhotoController.php

示例3: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param $id
  * @return Response
  */
 public function destroy(Photo $photo)
 {
     $photo->delete();
 }
开发者ID:xing393939,项目名称:Laravel-5-Bootstrap-3-Starter-Site,代码行数:10,代码来源:PhotoController.php

示例4: deleteFile

 public function deleteFile(Photo $photo)
 {
     @unlink(public_path() . $photo->path);
     $photo->delete();
 }
开发者ID:devillom,项目名称:simpleshop,代码行数:5,代码来源:PhotoController.php

示例5: destroy

 public function destroy(Blog $blog, BlogPost $blogPost, Photo $photo)
 {
     $photo->delete();
     return back();
 }
开发者ID:PYuen1029,项目名称:yappietravels,代码行数:5,代码来源:PhotoController.php


注:本文中的app\Photo::delete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。