本文整理匯總了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");
}