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