當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。