本文整理汇总了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);
}
示例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;
}
示例3: destroy
/**
* Remove the specified resource from storage.
*
* @param $id
* @return Response
*/
public function destroy(Photo $photo)
{
$photo->delete();
}
示例4: deleteFile
public function deleteFile(Photo $photo)
{
@unlink(public_path() . $photo->path);
$photo->delete();
}
示例5: destroy
public function destroy(Blog $blog, BlogPost $blogPost, Photo $photo)
{
$photo->delete();
return back();
}