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


PHP Storage::url方法代码示例

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


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

示例1: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $user = $this->createUser();
     $video = new Video();
     $video->name = 'demo';
     $video->category = 'Movie';
     $video->path = Storage::url('videos/demo');
     $user->getVideos()->save($video);
 }
开发者ID:alvaradoadam15,项目名称:laraveltube,代码行数:14,代码来源:VideosTableSeeder.php

示例2: handleSingleFile

 /**
  * @param $file
  *
  * @return Document
  * @throws \Exception
  */
 public function handleSingleFile($file)
 {
     if (!$file instanceof UploadedFile) {
         throw new \Exception("Dados inválidos para upload");
     }
     $document = $this->createDocument($file);
     $this->processBeforeSave($document);
     $disk = Storage::disk()->getDriver();
     $disk->put($document->filePath, fopen($file, 'r+'), ['visibility' => 'public', 'ContentType' => $document->mimeType]);
     $document->url = config('filesystems.default') == 'public' ? asset('images/' . $document->filePath) : Storage::url($document->filePath);
     $document->save();
     $this->addFileToList($document);
     return $document;
 }
开发者ID:lfalmeida,项目名称:lbase,代码行数:20,代码来源:Uploader.php

示例3: store

 /**
  * Store a newly created video in storage.
  *
  * @param VideoUploadRequest $request
  *
  * @return mixed
  */
 public function store(VideoUploadRequest $request)
 {
     $user = $this->user->authenticated();
     $file = $request->video;
     $nameFile = str_replace(' ', '', $request->input('name') . $user->id);
     $data = ['name' => $request->input('name'), 'category' => $request->input('category'), 'path' => Storage::url('videos/' . $nameFile), 'user_id' => $user->id];
     $video = $this->video->create($data);
     $this->saveAndConvert($file, $nameFile);
     return $this->response->withItem($video, $this->videoTransformer);
 }
开发者ID:alvaradoadam15,项目名称:laraveltube,代码行数:17,代码来源:VideoController.php

示例4: storeImage

 /**
  * Store image avatar.
  *
  * @param $image
  * @param $user
  *
  * @return mixed
  */
 private function storeImage($image, $user)
 {
     $path = Storage::url('images/avatars/' . $user->id . '.' . $image->getClientOriginalExtension());
     Storage::disk('public')->put('images/avatars/' . $user->id . '.' . $image->getClientOriginalExtension(), file_get_contents($image->getRealPath()));
     return $path;
 }
开发者ID:alvaradoadam15,项目名称:laraveltube,代码行数:14,代码来源:UserController.php

示例5: getUrl

 public static function getUrl($filename)
 {
     return Storage::url(self::setEnvironment() . $filename);
 }
开发者ID:jarriaga,项目名称:cuandomepagas.com,代码行数:4,代码来源:ImageController.php


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