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


PHP Storage::exists方法代码示例

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


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

示例1: handle

 /**
  * Rename the file directory to rename the file in the system
  *
  */
 public function handle()
 {
     if (Storage::exists($this->getOldFileDirectory())) {
         Storage::move($this->getOldFileDirectory(), $this->getNewFileDirectory());
     }
     event(new FileWasRenamed($this->from, $this->to));
 }
开发者ID:phileserver,项目名称:core,代码行数:11,代码来源:RenameFile.php

示例2: retrieveFile

 public function retrieveFile(Submission $submissions, $file)
 {
     $form = $submissions->formdefinition()->first();
     if ($submissions->group()->users()->get()->contains(Auth::user())) {
         //$file = Storage::get("form/".$form->id."/".$file);
         $filepath = "form/" . $form->id . "/" . $file;
         //Storage::get(form/)
         // if(Storage::exists($filepath)){
         /* if(copy($filepath,"/var/www/calwebtool/public/downloads/".$file)){
                    return respones()->file("downloads/".$file);
                }
                //Storage::copy($filepath,"downloads/".$file);
                return response()->file("downloads/".$file);
            //}
            /*else{
                flash()->overlay("The file does not exist.","Not Found");
                return redirect()->back();
            }*/
         if (Storage::exists($filepath)) {
             if (Storage::exists("downloads/" . $file)) {
                 Storage::delete("downloads/" . $file);
             }
             Storage::copy($filepath, "downloads/" . $file);
             return response()->download("downloads/" . $file);
         }
     }
 }
开发者ID:kcattakcaz,项目名称:CALwebtool,代码行数:27,代码来源:SubmissionController.php

示例3: getLastVisit

 /**
  * Read last visited timestamp from file and return
  * timestamp as Carbon object or return zero.
  *
  * @return int|\Carbon\Carbon
  */
 protected function getLastVisit()
 {
     if (Storage::exists('visited.txt')) {
         return Carbon::createFromTimestamp(Storage::get('visited.txt'));
     }
     return 0;
 }
开发者ID:raffw7912,项目名称:challenge,代码行数:13,代码来源:CompanyController.php

示例4: handle

 /**
  * Delete the directory with the filename and all files inside
  * Fire FileWasDeleted Event
  *
  */
 public function handle()
 {
     if (Storage::exists($this->getFileDirectory())) {
         Storage::deleteDirectory($this->getFileDirectory());
     }
     event(new FileWasDeleted($this->filename));
 }
开发者ID:phileserver,项目名称:core,代码行数:12,代码来源:DeleteFile.php

示例5: membersMapNorway

 /**
  * Norwegian map with municipalities where Alternativet is represented highlighted
  */
 public function membersMapNorway()
 {
     $data = "";
     if (!Storage::exists('members-norway-map.svg') || Storage::lastModified('members-norway-map.svg') <= time() - 60 * 60 * 24) {
         $svg = simplexml_load_file(base_path() . '/resources/svg/Norway_municipalities_2012_blank.svg');
         // Determine which municipalities there are members in
         $result = DB::select(DB::raw("\n              select postal_areas.municipality_code, count(*) as count\n              from users\n              left join postal_areas\n              on (users.postal_code = postal_areas.postal_code)\n              group by municipality_code"));
         $municipalities = [];
         foreach ($result as $row) {
             if ($row->municipality_code) {
                 $municipalities[] = $row->municipality_code;
             }
         }
         foreach ($svg->g as $county) {
             foreach ($county->path as $path) {
                 if (in_array($path['id'], $municipalities)) {
                     // There are members in this municipality
                     $path['style'] = 'fill:#0f0;fill-opacity:1;stroke:none';
                 } else {
                     $path['style'] = 'fill:#777;fill-opacity:1;stroke:none';
                 }
             }
         }
         $data = $svg->asXML();
         Storage::put('members-norway-map.svg', $data);
     }
     if (empty($data)) {
         $data = Storage::get('members-norway-map.svg');
     }
     return response($data)->header('Content-Type', 'image/svg+xml');
 }
开发者ID:partialternativet,项目名称:api,代码行数:34,代码来源:GraphicsController.php

示例6: handle

 public function handle($payload)
 {
     $this->folder = $payload['folder'];
     $this->cleanUp();
     if (isset($payload['bucket'])) {
         Config::set('S3_BUCKET', $payload['bucket']);
     }
     if (isset($payload['region'])) {
         Config::set('S3_REGION', $payload['region']);
     }
     if (isset($payload['secret'])) {
         Config::set('S3_SECRET', $payload['secret']);
     }
     if (isset($payload['key'])) {
         Config::set('S3_KEY', $payload['key']);
     }
     if (isset($payload['destination'])) {
         $this->thumbnail_destination = $payload['destination'];
     } else {
         $this->thumbnail_destination = base_path("storage");
     }
     if (!Storage::exists($this->thumbnail_destination)) {
         Storage::makeDirectory($this->thumbnail_destination, 0755, true);
     }
     $files = Storage::disk('s3')->allFiles($this->folder);
     Log::info(print_r($files, 1));
     $this->getAndMake($files);
     $this->uploadFilesBacktoS3();
     $this->cleanUp();
 }
开发者ID:nagyistoce,项目名称:thumbnail-maker,代码行数:30,代码来源:ThumbMakerService.php

示例7: generateFilename

 /**
  * Generate random string for a filename
  *
  * @param string $ext
  * @param string $location
  * @return string
  */
 private function generateFilename()
 {
     $filename = str_random(100) . "." . $this->extension;
     if (Storage::exists($this->folder . '/' . $filename)) {
         $this->generateFilename();
     }
     return $filename;
 }
开发者ID:philsquare,项目名称:laramanager,代码行数:15,代码来源:Upload.php

示例8: compose

 /**
  * Bind data to the view.
  *
  * @param View $view
  *
  * @return void
  */
 public function compose(View $view)
 {
     $locale = app()->getLocale();
     $filename = Request::route()->getName() . '.md';
     $filepath = 'userhelp' . DIRECTORY_SEPARATOR . $locale . DIRECTORY_SEPARATOR . $filename;
     $help = Storage::exists($filepath) ? Markdown::convertToHtml(Storage::get($filepath)) : '';
     $view->with('help', $help);
 }
开发者ID:josevh,项目名称:timegrid,代码行数:15,代码来源:UserHelpComposer.php

示例9: createFilename

 /**
  * Generate random string for a filename
  *
  * @param string $ext
  * @param string $location
  * @return string
  */
 public function createFilename($ext, $location)
 {
     $filename = str_random(100) . ".{$ext}";
     if (Storage::exists("{$location}/{$filename}")) {
         $this->createFilename($ext, $location);
     }
     return $filename;
 }
开发者ID:philsquare,项目名称:laraform,代码行数:15,代码来源:Files.php

示例10: delete

 /**
  * @param $id
  * @return array
  */
 public function delete($id)
 {
     $obj = $this->rep->find($id);
     if (Storage::exists($obj->id . '.' . $obj->extension)) {
         Storage::delete($obj->id . '.' . $obj->extension);
     }
     return parent::delete($id);
 }
开发者ID:ao-lab,项目名称:laravel-manager,代码行数:12,代码来源:ArchiveService.php

示例11: deleteFile

 public function deleteFile($id)
 {
     $pf = $this->repository->find($id);
     $filename = $pf->name . "." . $pf->extension;
     if (Storage::exists($filename) && $this->delete($id)) {
         return Storage::delete($filename);
     }
     return true;
 }
开发者ID:riczat,项目名称:anglar,代码行数:9,代码来源:ProjectFileService.php

示例12: handle

 /**
  * Save the file
  * Fire FileWasSaved Event
  *
  */
 public function handle()
 {
     if (Storage::exists($this->getDefaultFileName())) {
         if (!$this->force) {
             return;
         }
     }
     $this->saveFile();
     event(new FileWasSaved($this->filename, $this->force));
 }
开发者ID:phileserver,项目名称:core,代码行数:15,代码来源:SaveFile.php

示例13: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($path)
 {
     $entry = FileEntry::where('filename', '=', $path)->first();
     if ($entry == null || !Storage::exists($path)) {
         return response('NotFound', 404);
     } else {
         $file = Storage::get($entry->filename);
         return response($file)->header('Content-Type', $entry->mime);
     }
 }
开发者ID:mg9,项目名称:koalaBazaar,代码行数:16,代码来源:FileEntryController.php

示例14: postEliminar

 public function postEliminar()
 {
     $id = Input::get('id');
     $medio = Input::get('medio');
     if (Storage::exists($medio)) {
         Storage::delete($medio);
     }
     Medio::find(Input::get('id'))->fill(Input::all())->delete();
     return response()->json(["mensaje" => "eliminado"]);
 }
开发者ID:3JSoluciones,项目名称:cafesdelhuila,代码行数:10,代码来源:MediosController.php

示例15: get

 public function get($filename)
 {
     $path = config('images.path') . $filename;
     if (!Storage::exists($path)) {
         throw new ImageNotFoundHttpException();
     }
     $data = Storage::get($path);
     $mime = finfo_buffer(finfo_open(FILEINFO_MIME_TYPE), $data);
     return Response::make($data)->header('Content-Type', $mime)->header('Content-Length', strlen($data));
 }
开发者ID:B1naryStudio,项目名称:asciit,代码行数:10,代码来源:ImageService.php


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