本文整理汇总了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);
}
示例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;
}
示例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);
}
示例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;
}
示例5: getUrl
public static function getUrl($filename)
{
return Storage::url(self::setEnvironment() . $filename);
}