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


PHP Storage::exists方法代码示例

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


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

示例1: run

 public function run($token)
 {
     $env = Environment::where('token', $token)->first();
     if (is_null($env)) {
         return json_encode(['error' => true, 'output' => 'invalid token']);
     }
     if (\Storage::exists($token . '.php')) {
         $tokenFile = \Storage::disk('local')->getDriver()->getAdapter()->getPathPrefix() . "/" . $token . ".php";
         $output = null;
         $error = false;
         foreach ($this->steps as $step) {
             $command = "dep --ansi --file={$tokenFile} {$step} " . $env->server->host;
             $output .= $command . "\n";
             $process = new Process($command);
             $process->run();
             if (!$process->isSuccessful()) {
                 $output .= $process->getErrorOutput();
                 $error = true;
                 break;
             } else {
                 $output .= $process->getOutput();
             }
         }
         $history = EnvironmentHistory::create(['environment_id' => $env->id, 'status' => $error ? 'fail' : 'success', 'history' => $output]);
         return json_encode(['error' => $error, 'output' => $output]);
     }
 }
开发者ID:sean111,项目名称:phpdeploy,代码行数:27,代码来源:DeployController.php

示例2: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  StoreMediaRequest  $request
  * @return Response
  */
 public function store(StoreMediaRequest $request)
 {
     if ($request->ajax()) {
         $response = ['error' => 1, 'path' => ''];
         if ($request->hasFile('file')) {
             $file = $request->file('file');
             $folder = '/public/uploads/' . $request->folder;
             if (!\Storage::exists($folder)) {
                 \Storage::makeDirectory($folder);
             }
             $path = $folder . '/' . date('Y-m-d');
             $hashed = sha1(Str::slug($file->getClientOriginalName() . time())) . '.' . $file->getClientOriginalExtension();
             if (!\Storage::exists($path)) {
                 \Storage::makeDirectory($path);
             }
             if ($file->move(storage_path('app') . $path, $hashed)) {
                 $path = str_replace('/public', '', $path);
                 $medium = $this->medium->create(['path' => $path . '/' . $hashed]);
                 if ($medium) {
                     $response['error'] = 0;
                     $response['path'] = $path . '/' . $hashed;
                     return response($response, 200);
                 }
                 // TODO: ln -s storage/app/public/uploads /path/to/public_html/public
             }
         }
     }
     return response('error', 400);
 }
开发者ID:wislem,项目名称:berrier,代码行数:35,代码来源:MediaController.php

示例3: checkDirectoryExists

 /**
  * Checks if the Database Directory exists,
  * if not, directory will be created.
  */
 private function checkDirectoryExists()
 {
     $directory = storage_path($this->directoryPath);
     if (!$this->storage->exists($directory)) {
         $this->storage->makeDirectory($directory);
     }
 }
开发者ID:gpopoteur,项目名称:flat,代码行数:11,代码来源:SqliteSchema.php

示例4: down

 /**
  * Reverse the migrations.
  *
  * @return void
  */
 public function down()
 {
     // If DB file exists delete it
     if (Storage::exists(database_path('SPGProfileDB.sqlite'))) {
         Storage::delete(database_path('SPGProfileDB.sqlite'));
     }
     Schema::connection($this->TargetDB)->drop('pass_profiles');
 }
开发者ID:Dev1436,项目名称:laravel-securepassgen,代码行数:13,代码来源:2015_12_12_012546_create_pass_profiles_table.php

示例5: getImg

 private static function getImg(Meeting $meeting)
 {
     $name = 'meetings/' . $meeting->id;
     if (!\Storage::exists($name)) {
         return false;
     }
     return \Storage::get($name);
 }
开发者ID:dsd-meetme,项目名称:backend,代码行数:8,代码来源:MeetingsController.php

示例6: delete

 public function delete($projectId, $id)
 {
     try {
         $projectFile = $this->repository->find($id);
         if ($this->storage->exists($projectFile->getFileName())) {
             $this->storage->delete($projectFile->getFileName());
         }
         $this->repository->delete($id);
         return ['success' => true, "message" => 'Registro excluído com sucesso.'];
     } catch (ModelNotFoundException $e) {
         return ['error' => true, 'message' => 'Registro não encontrado.', "messageDev" => $e->getMessage()];
     } catch (QueryException $e) {
         return ['error' => true, 'message' => 'Este registro não pode ser excluído, pois existe um ou mais projetos vinculados a ele.', "messageDev" => $e->getMessage()];
     } catch (\Exception $e) {
         return ["error" => true, "message" => 'Falha ao excluir registro.', "messageDev" => $e->getMessage()];
     }
 }
开发者ID:jonasleitep4,项目名称:curso-laravel-angular,代码行数:17,代码来源:ProjectFileService.php

示例7: verfoto

 public function verfoto(Request $request)
 {
     $public_path = public_path();
     //$url = $public_path.'/storage/'.$request->archivo;
     $url = \Storage::disk('local') . $request->archivo;
     //verificamos si el archivo existe y lo retornamos
     if (Storage::exists($archivo)) {
         return response()->download($url);
     }
     //si no se encuentra lanzamos un error 404.
     abort(404);
 }
开发者ID:jlobaton,项目名称:inventario,代码行数:12,代码来源:MigracionController.php

示例8: setContent

 public function setContent($content = null)
 {
     if ($content == null || !is_array($content)) {
         $content = $this->getContent();
     }
     $this->content = $content;
     \Storage::put($this->file_directory . '/' . $this->file_name . '-' . $this->id . '.json', json_encode($this->content));
     if (\Storage::exists($this->file_directory . '/' . $this->file_name . '.json')) {
         \Storage::delete($this->file_directory . '/' . $this->file_name . '.json');
     }
     \Storage::copy($this->file_directory . '/' . $this->file_name . '-' . $this->id . '.json', $this->file_directory . '/' . $this->file_name . '.json');
     return $this->content;
 }
开发者ID:schlos,项目名称:GreenAlert,代码行数:13,代码来源:Scrape.php

示例9: get

 public function get($id)
 {
     // $entry = File::where('filename', '=', $filename)->firstOrFail();
     // $file = \Storage::disk('local')->get($entry->filename);
     // // return (new \Response($file, 200))
     //             // ->header('Content-Type', $entry->mime);
     // return response($file,200)
     //           ->header('Content-Type', $entry->mime);
     // ===============================================================================================
     // $entry = File::where('filename', '=', $filename)->firstOrFail();
     // 	if (\Storage::exists($entry->filename)) {
     // 	$file = \Storage::disk('local')->get($entry->filename);
     // 	// return (new \Response($file, 200))
     //              // ->header('Content-Type', $entry->mime);
     // 	return response($file,200)
     //            ->header('Content-Type', $entry->mime);
     // 	}
     // 	else{
     // 		return 'File Rusak atau tidak ditemukan, Silahkan Update Ulang ';
     // 	}
     $entry = File::find(base64_decode($id));
     // dd($entry);
     if ($entry) {
         $dirfile = empty($entry->nama_baru) ? $entry->filename : $entry->dir . '/' . $entry->nama_baru;
         // echo $dirfile;
         // ARSIPPROSESSP2D-UYUYphpFDCC.tmp.pdf
         // dinas-p/ARSIPPROSESSP2D-UYUYphpF441.tmp.pdf
         // dd($dirfile);
         // dd($dirfile);
         // "SEKWAN-II/164-sp2d-nhl-setwn-09-arsipprosessp2d-164-sp2d-nhl-setwn-09-phpCAC5.tmp.pdf";
         // "164-sp2d-nhl-setwn-09-arsipprosessp2d-164-sp2d-nhl-setwn-09-1-php757E.tmp"
         if (\Storage::exists($dirfile)) {
             $file = \Storage::get($dirfile);
             // return (new \Response($file, 200))
             // ->header('Content-Type', $entry->mime);
             return response($file, 200)->header('Content-Type', $entry->mime);
         } elseif (!empty($entry->filename) && \Storage::exists($entry->filename)) {
             $file = \Storage::get($entry->filename);
             // return (new \Response($file, 200))
             // ->header('Content-Type', $entry->mime);
             return response($file, 200)->header('Content-Type', $entry->mime);
         } else {
             return 'File tidak ditemukan, Silahkan Update Ulang ';
         }
     } else {
         return 'Data File Rusak atau tidak ditemukan, Silahkan Update Ulang ';
     }
 }
开发者ID:acmadi,项目名称:sp2d,代码行数:48,代码来源:FileController.php

示例10: get

 public function get($filename, $size = null)
 {
     // Cut original file name
     $file = explode('.', $filename);
     $file_path = '';
     if (empty($filename)) {
         return '';
     }
     if (empty($size) && \Storage::exists($this->basepath . $file[0] . '_L.' . $file[1])) {
         $file_path = $this->basepath . $file[0] . '_L.' . $file[1];
     } else {
         if (\Storage::exists($this->basepath . $file[0] . '_' . $size . '.' . $file[1])) {
             $file_path = $this->basepath . $file[0] . '_' . $size . '.' . $file[1];
         } else {
             $file_path = $this->basepath . $filename;
         }
     }
     return url($file_path);
 }
开发者ID:wielski,项目名称:laravel-fileapi,代码行数:19,代码来源:FileApi.php

示例11: get

 public function get($filename, $size = null)
 {
     if (empty($filename)) {
         return '';
     }
     // Cut original file name
     $file = explode('.', $filename);
     $file_path = '';
     if (empty($filename)) {
         return '';
     }
     if (empty($size) && \Storage::exists($this->basepath . $file[0] . '_L.' . $file[1])) {
         $file_path = $this->basepath . $file[0] . '_L.' . $file[1];
     } elseif (\Storage::exists($this->basepath . $file[0] . '_' . $size . '.' . $file[1])) {
         $file_path = $this->basepath . $file[0] . '_' . $size . '.' . $file[1];
     } else {
         $file_path = $this->basepath . $filename;
     }
     if (\Config::get('filesystems.default') == 's3') {
         return \Storage::getDriver()->getAdapter()->getClient()->getObjectUrl(\Storage::getDriver()->getAdapter()->getBucket(), $this->basepath . $filename);
     } else {
         return url($file_path);
     }
 }
开发者ID:unisharp,项目名称:laravel-fileapi,代码行数:24,代码来源:FileApi.php

示例12: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $data_dokumen = Dokumens::find($id);
     $data_dokumen_pesan = $data_dokumen;
     // dd($data_dokumen_pesan->nama_skpd);
     if ($data_dokumen) {
         $data_dokumen->delete();
         $file = $data_dokumen->file;
         // dd($file);
         // $file->get()['filename'];
         if ($file) {
             $lokasi_baru = $file->dir . '/' . $file->nama_baru;
             $lokasi_lama = $file->filename;
             if ($file->nama_baru && $file->dir && \Storage::exists($lokasi_baru)) {
                 # code...
                 // echo $lokasi_baru;
                 \Storage::move($lokasi_baru, 'RecycleBin/' . $file->nama_baru);
             }
             if (\Storage::exists($lokasi_lama)) {
                 // echo $lokasi_lama;
                 \Storage::move($lokasi_lama, 'RecycleBin/' . $file->filename);
                 # code...
             }
             // $file->delete();
         }
     }
     $data_dokumenx = Dokumens::find($id);
     if (!$data_dokumenx) {
         return 'Sukses data SPPD  ' . $data_dokumen_pesan->no_sppd;
     } else {
         return 'gagal data SPPD  ' . $data_dokumen_pesan->no_sppd;
     }
     // return __function__;
     //
 }
开发者ID:acmadi,项目名称:sp2d,代码行数:41,代码来源:DokumensController.php

示例13:

            <th>TAMAÑO</th>
            <th>CREADO</th>
            <th>ACCION</th>
        </tr>
        </thead>
        <tbody>
        @foreach($medios as $medio)

            <tr>
                <td>{{ $medio->id }}</td>
                <td>
                  <a href="/medios/{{ $medio->nombre}}" target="newwindow"
                    data-toggle="tooltip" data-placement="right"
                    title="PRESIONE CLICK PARA VER O DESCARGAR SEGUN SEA EL TIPO DE ARCHIVO">
                    <?php 
if (Storage::exists($medio->nombre)) {
    $nombre = $medio->nombre;
    $tamanio = Storage::size($medio->nombre);
    $creado = $medio->created_at;
    $tipo = $medio->tipo;
    if ($tipo == 'jpg' || $tipo == 'png' || $tipo == 'jpeg' || $tipo == 'gif') {
        ?>
<img class="img_click" src="/medios/{{ $medio->nombre}}"><?php 
    } else {
        if ($tipo == 'pdf') {
            ?>
<img class="img_click" src="/img/pdf.png"><?php 
        } else {
            if ($tipo == 'doc' || $tipo == 'dot' || $tipo == 'docx') {
                ?>
<img class="img_click" src="/img/m_word.png"><?php 
开发者ID:3JSoluciones,项目名称:cafesdelhuila,代码行数:31,代码来源:listado.blade.php

示例14: getLoginOk

 public function getLoginOk($wxuin)
 {
     $file = "user/{$wxuin}.txt";
     if (\Storage::exists($file)) {
         $user = \Storage::get($file);
         $user = json_decode($user);
     } else {
         return '不存在此wxuin';
     }
     //进行post登陆尝试
     $url = "https://wx.qq.com/cgi-bin/mmwebwx-bin/webwxinit?lang=zh_CN&pass_ticket=" . urlencode($user->pass_ticket) . "&r=-" . rr();
     $post = '{"BaseRequest":{"Uin":"' . $user->cookies->wxuin . '","Sid":"' . $user->cookies->wxsid . '","Skey":"' . $user->skey . '","DeviceID":"' . $user->deviceid . '"}}';
     $ret = CURL::send($url, ['Cookie' => urldecode(http_build_query($user->cookies, '', '; '))], ['follow_redirects' => false], ['ret' => 'all', 'post' => $post]);
     $cookies = toCookies($ret->cookies);
     $cookies = (object) ((array) $cookies + (array) $user->cookies);
     //判断是否正常
     $data_arr = json_decode($ret->body, true);
     if (count($data_arr)) {
         if (!isset($data_arr['BaseResponse']['Ret'])) {
             $data_arr = array();
         } else {
             if ($data_arr['BaseResponse']['Ret'] != 0) {
                 return $data_arr['BaseResponse']['Ret'] . $data_arr['BaseResponse']['ErrMsg'] . ',请从新<a href="/login/">扫描</a>';
             }
         }
     } else {
         return '没有获取到内容,请从新<a href="/login/">扫描</a>';
     }
     //开始获取基本信息了
     $data['Uin'] = $data_arr['User']['Uin'];
     $data['UserName'] = $data_arr['User']['UserName'];
     $data['NickName'] = $data_arr['User']['NickName'];
     $data['SyncKey'] = json_encode($data_arr['SyncKey']);
     $data['wxuin'] = $cookies->wxuin;
     $data['skey'] = urldecode($user->skey);
     $data['pass_ticket'] = urldecode($user->pass_ticket);
     $data['deviceid'] = $user->deviceid;
     $data['cookies'] = json_encode($cookies);
     //设置状态为可用
     $data['status'] = 1;
     Login::inSave($data);
     //删除临时文件
     \Storage::delete($file);
     //写入好友信息
     $this->ContactList($data_arr);
     //加入群信息获取队列
     $job = (new JobChatroom($data['wxuin']))->onQueue('chatroom');
     $this->dispatch($job);
     //加入监控队列
     $job = (new JobCheck($data['wxuin']))->onQueue('check');
     $this->dispatch($job);
 }
开发者ID:wangtongphp,项目名称:weixin-stat,代码行数:52,代码来源:LoginController.php

示例15: removeFile

 public function removeFile($filename, Flash $flash)
 {
     $file = "{$filename}.pdf";
     if (\Storage::exists($file)) {
         \Storage::delete($file);
         $flash->success('File has been deleted.');
     }
     return redirect()->back();
 }
开发者ID:skiwei,项目名称:sayangholidays,代码行数:9,代码来源:InvoicesController.php


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