本文整理汇总了PHP中Illuminate\Support\Facades\Storage::has方法的典型用法代码示例。如果您正苦于以下问题:PHP Storage::has方法的具体用法?PHP Storage::has怎么用?PHP Storage::has使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Support\Facades\Storage
的用法示例。
在下文中一共展示了Storage::has方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: destroyFile
/**
* Destroy file
* Path is relative to /app directory
*
* @param $filenamepath
*/
public function destroyFile($filenamepath)
{
if (Storage::has($filenamepath)) {
return Storage::delete($filenamepath);
}
return true;
}
示例2: download
public function download(Request $request, $original_filename)
{
$entry = FileEntry::where('original_filename', '=', $original_filename)->firstOrFail();
if (Storage::has($request->user()->id . '/' . $entry->original_filename)) {
$file = Storage::get($request->user()->id . '/' . $entry->original_filename);
return (new Response($file, 200))->header('Content-Description', 'File Transfer')->header('Content-Type', $entry->mime)->header('Content-Disposition', 'attachment; filename=' . $entry->original_filename)->header('Content-Transfer-Encoding', 'binary')->header('Connection', 'Keep-Alive')->header('Expires', 0)->header('Cache-Control', 'must-revalidate, post-check=0, pre-check=0')->header('Pragma', 'public')->header('Content-Length', $entry->size);
// ->header('Content-Type', $entry->mime);
}
$sys_notifications[] = array('type' => 'danger', 'message' => 'O arquivo não existe!');
$request->session()->flash('sys_notifications', $sys_notifications);
return back()->withInput($request->all());
}
示例3: filenameExists
private function filenameExists($filename)
{
return Storage::has('laramanager/images/' . $filename);
}
示例4: destroyFile
protected function destroyFile($filenamePath)
{
if (Storage::has($filenamePath)) {
Storage::delete($filenamePath);
}
}
示例5: getAvatarSmallLinkAttribute
public function getAvatarSmallLinkAttribute()
{
if (Storage::has('contact/' . $this->id . '/avatar.png')) {
return "<img src='" . url('avatar/' . $this->id) . "' class='img-circle' style='height: 75px; padding:5px;'>";
} else {
if ($this->is_deceased) {
return "<img src='" . url('img/dead.png') . "' class='img-circle' style='height: 75px; padding:5px;'>";
} else {
return "<img src='" . url('img/default.png') . "' class='img-circle' style='height: 75px; padding:5px;'>";
}
}
}
示例6: getRetreatEvaluationsLinkAttribute
public function getRetreatEvaluationsLinkAttribute()
{
if (Storage::has('event/' . $this->id . '/evaluations.pdf')) {
$img = Html::image('img/evaluation.png', 'Evaluations', array('title' => "Evaluations"));
$link = '<a href="' . url('retreat/' . $this->id . '/evaluations" ') . 'class="btn btn-default" style="padding: 3px;">' . $img . '</a>';
return $link;
} else {
return NULL;
}
}
示例7: getImagePath
/**
* Returns full image path from given filename
*
* @param string $filename
* @return string
*/
private function getImagePath($filename)
{
// find file
foreach (config('imagecache.paths') as $path) {
// don't allow '..' in filenames
$image_path = $path . '/' . str_replace('..', '', $filename);
if (file_exists($image_path) && is_file($image_path)) {
// file found
return file_get_contents($image_path);
}
}
//find file with Storage
if (Storage::has('images/' . $filename)) {
$image_path = Storage::get('images/' . $filename);
return $image_path;
}
// file not found
abort(404);
}