Skip to content

Commit

Permalink
Merge pull request #1 from designmynight/storage-options
Browse files Browse the repository at this point in the history
feat: adds ability to set filesystem storage options
  • Loading branch information
jmosul authored Dec 27, 2018
2 parents 78f5bf3 + aadf601 commit e9231f9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
11 changes: 11 additions & 0 deletions src/Concerns/WithStorageOptions.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

namespace Maatwebsite\Excel\Concerns;

interface WithStorageOptions
{
/**
* @return string
*/
public function storageOptions(): array;
}
5 changes: 4 additions & 1 deletion src/Excel.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Maatwebsite\Excel;

use Illuminate\Support\Collection;
use Maatwebsite\Excel\Concerns\WithStorageOptions;
use PhpOffice\PhpSpreadsheet\IOFactory;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Contracts\Filesystem\Factory;
Expand Down Expand Up @@ -97,7 +98,9 @@ public function store($export, string $filePath, string $disk = null, string $wr

$file = $this->export($export, $filePath, $writerType);

return $this->filesystem->disk($disk)->put($filePath, fopen($file, 'r+'));
$options = $export instanceof WithStorageOptions ? $export->storageOptions() : [];

return $this->filesystem->disk($disk)->put($filePath, fopen($file, 'r+'), $options);
}

/**
Expand Down

0 comments on commit e9231f9

Please sign in to comment.