本文整理汇总了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));
}
示例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);
}
}
}
示例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;
}
示例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));
}
示例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');
}
示例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();
}
示例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;
}
示例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);
}
示例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;
}
示例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);
}
示例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;
}
示例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));
}
示例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);
}
}
示例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"]);
}
示例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));
}