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


PHP Image::findOrFail方法代码示例

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


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

示例1: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $image = Image::findOrFail($id);
     $image->delete();
     flash()->warning('Gambar telah dihapus!');
     return redirect('/dashboard/images');
 }
开发者ID:kobeuu,项目名称:bpb-sf,代码行数:13,代码来源:ImagesController.php

示例2: update

 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  *
  * @return Response
  */
 public function update($id, Request $request)
 {
     $this->validate($request, ['original_name' => 'required', 'filename' => 'required']);
     $image = Image::findOrFail($id);
     $image->update($request->all());
     Session::flash('flash_message', 'Image updated!');
     return redirect('admin/image');
 }
开发者ID:wilderguzman,项目名称:lugrawibe,代码行数:15,代码来源:ImageController.php

示例3: saveImageAlt

 private static function saveImageAlt($image_id, $alt)
 {
     if (empty($alt)) {
         return;
     }
     $Image = \App\Image::findOrFail($image_id);
     $Image->imgalt = $alt;
     $Image->save();
     return;
 }
开发者ID:brevig907,项目名称:apt,代码行数:10,代码来源:DashboardController.php

示例4: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     if (Gate::denies('admin')) {
         abort(403);
     }
     $image = Image::findOrFail($id);
     ImageRelease::where('image_id', $id)->delete();
     ImageTrack::where('image_id', $id)->delete();
     ArtistImage::where('image_id', $id)->delete();
     if (Storage::disk('images')->has($image->path)) {
         Storage::disk('images')->delete($image->path);
     }
     $image->delete();
     return redirect()->route('home.index')->with('alert-success', [trans('htmusic.deleted')]);
 }
开发者ID:milutinm,项目名称:htmusic,代码行数:21,代码来源:ImageController.php

示例5: destroy

 public function destroy($id)
 {
     Image::findOrFail($id)->delete();
     session()->flash('flash_message', 'Photo Deleted');
     return redirect('/gallery');
 }
开发者ID:mathewsandi,项目名称:PennasSite,代码行数:6,代码来源:UploadController.php

示例6: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     Image::findOrFail($id)->delete();
     return trans('images.removed');
 }
开发者ID:Vatia13,项目名称:megaportal,代码行数:11,代码来源:ImagesController.php

示例7: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $img = Image::findOrFail($id);
     // base path
     $base_path = public_path() . "/images/";
     // remove from file system
     // remove thumb
     unlink($base_path . "thumbs/{$img->path}");
     // remove image
     unlink($base_path . "{$img->path}");
     // remove from database
     $img->delete();
 }
开发者ID:john-ko,项目名称:sharonypark,代码行数:19,代码来源:ImageController.php

示例8: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $image = Image::findOrFail($id);
     $image->delete();
     Session::flash('flash_message', 'Image successfully deleted!');
     return redirect()->route('images.index');
 }
开发者ID:Tasmia09,项目名称:BakeACake,代码行数:13,代码来源:ImagesController.php

示例9: postChange

 public function postChange(Request $request)
 {
     $input = $request->all();
     $image = Image::findOrFail($input['id']);
     $file = Input::file('images');
     $rules = array('file' => 'image|max:3000');
     $validator = Validator::make($input, $rules);
     if ($validator->fails()) {
         Session::flash('flash_message', 'Ошибка записи файлов!');
         return redirect()->back();
     } else {
         $destinationPath = 'uploads/images/';
         $filename = str_random(15) . '_' . substr($file->getClientOriginalName(), 0, strpos($file->getClientOriginalName(), ".")) . '.' . $file->getClientOriginalExtension();
         $upload_success = $file->move($destinationPath, $filename);
         $image->path = $destinationPath . $filename;
         $image->save();
         unlink($input['path']);
         Session::flash('flash_message', 'Картинка успешно изменена!');
     }
     return redirect()->back();
 }
开发者ID:vitaloldos,项目名称:shop,代码行数:21,代码来源:ImagesController.php

示例10: findOrFail

 public function findOrFail($id)
 {
     return Image::findOrFail($id);
 }
开发者ID:jeroenhekihenk,项目名称:video-platform,代码行数:4,代码来源:ImagesRepository.php


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