本文整理汇总了PHP中storage::disk方法的典型用法代码示例。如果您正苦于以下问题:PHP storage::disk方法的具体用法?PHP storage::disk怎么用?PHP storage::disk使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类storage
的用法示例。
在下文中一共展示了storage::disk方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setup
/**
* @param $contract
* @return array
* @throws \Exception
*/
public function setup($contract)
{
$this->logger->info('Download started...', ['file' => $contract->file]);
$pdfFile = '';
try {
$pdfFile = $this->storage->disk('s3')->get($contract->file);
} catch (\Exception $e) {
$this->logger->error($e->getMessage(), ['contract id' => $contract->id, 'file' => $contract->file]);
}
$this->storage->disk('local')->put($contract->file, $pdfFile);
$this->logger->info('Download completed...', ['file' => $pdfFile]);
if (!$this->fileSystem->isDirectory($this->getContractDirectory($contract->id))) {
$this->addDirectory($contract->id, $this->getWriteDirectory());
}
$writeFolderPath = $this->getContractDirectory($contract->id);
$readFilePath = sprintf('%s/app/%s', storage_path(), $contract->file);
return [$writeFolderPath, $readFilePath];
}
示例2: configAboutUs
/**
* @Post("config/module/aboutUs")
*/
public function configAboutUs(Request $request)
{
$file = \Storage::disk('modules')->get('home/aboutUs.blade.php');
if ($request->description1 != "" || $request->description2 != "" || $request->description3 != "") {
if ($request->description1 != "") {
$file = preg_replace("/(<!--text1-->)(.*)(<!--endtext1-->)/", "<!--text1-->" . $request->description1 . "<!--endtext1-->", $file);
}
if ($request->description2 != "") {
$file = preg_replace("/(<!--text2-->)(.*)(<!--endtext2-->)/", "<!--text2-->" . $request->description2 . "<!--endtext2-->", $file);
}
if ($request->description3 != "") {
$file = preg_replace("/(<!--text3-->)(.*)(<!--endtext3-->)/", "<!--text3-->" . $request->description3 . "<!--endtext3-->", $file);
}
}
\Storage::disk('modules')->put('home/aboutUs.blade.php', $file);
if (isset($request->image1)) {
$image = $request->file('image1');
$nombre = $image->getClientOriginalName();
$format = substr($nombre, -3);
\Storage::disk('local')->put('modules/aboutUs/img1.' . $format, \File::get($image));
$file = \Storage::disk('modules')->get('home/aboutUs.blade.php');
$file = preg_replace("/(jpg)|(png)|(jpeg)/", $format, $file);
\storage::disk('modules')->put('home/aboutUs.blade.php', $file);
}
if (isset($request->image2)) {
$image = $request->file('image2');
$nombre = $image->getClientOriginalName();
$format = substr($nombre, -3);
\Storage::disk('local')->put('modules/aboutUs/img2.' . $format, \File::get($image));
$file = \Storage::disk('modules')->get('home/aboutUs.blade.php');
$file = preg_replace("/(jpg)|(png)|(jpeg)/", $format, $file);
\storage::disk('modules')->put('home/aboutUs.blade.php', $file);
}
if (isset($request->image3)) {
$image = $request->file('image3');
$nombre = $image->getClientOriginalName();
$format = substr($nombre, -3);
\Storage::disk('local')->put('modules/aboutUs/img3.' . $format, \File::get($image));
$file = \Storage::disk('modules')->get('home/aboutUs.blade.php');
$file = preg_replace("/(jpg)|(png)|(jpeg)/", $format, $file);
\storage::disk('modules')->put('home/aboutUs.blade.php', $file);
}
$file = \Storage::disk('modules')->get('home/aboutUs.blade.php');
if (isset($request->fontFormat)) {
switch ($request->fontFormat) {
case '1':
$file = preg_replace("/(font-family)(.*)/", "font-family: 'Courier New', Courier, monospace;", $file);
\storage::disk('modules')->put('home/aboutUs.blade.php', $file);
break;
case '2':
$file = preg_replace("/(font-family)(.*)/", "font-family: Georgia, 'Times New Roman', Times, serif;", $file);
\storage::disk('modules')->put('home/aboutUs.blade.php', $file);
break;
case '3':
$file = preg_replace("/(font-family)(.*)/", "font-family: Verdana, Arial, Helvetica, sans-serif;", $file);
\storage::disk('modules')->put('home/aboutUs.blade.php', $file);
break;
case '4':
$file = preg_replace("/(font-family)(.*)/", "font-family: 'Times New Roman', Times, serif;", $file);
\storage::disk('modules')->put('home/aboutUs.blade.php', $file);
break;
case '5':
$file = preg_replace("/(font-family)(.*)/", "font-family: Arial, Helvetica, sans-serif;", $file);
\storage::disk('modules')->put('home/aboutUs.blade.php', $file);
break;
}
}
$file = \Storage::disk('modules')->get('home/aboutUs.blade.php');
if (isset($request->descriptionColor)) {
$file = preg_replace("/(.image_under_monitor{background-color)(.*)/", ".image_under_monitor{background-color:" . $request->descriptionColor . ";", $file);
\storage::disk('modules')->put('home/aboutUs.blade.php', $file);
}
if (isset($request->backgroundColor)) {
$file = preg_replace("/(aboutUs{background-color)(.*)/", "aboutUs{background-color:" . $request->backgroundColor . ";", $file);
\storage::disk('modules')->put('home/aboutUs.blade.php', $file);
}
if (isset($request->fontColor)) {
$file = preg_replace("/(box{color)(.*)/", "box{color:" . $request->fontColor . ";", $file);
\storage::disk('modules')->put('home/aboutUs.blade.php', $file);
}
return Redirect::to("config/modulos/home");
}