for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace MagicLink\Actions;
use Illuminate\Support\Facades\Storage;
class DownloadFileAction extends ActionAbstract
{
protected $path;
protected $name;
protected $headers;
protected $disk;
/**
* Constructor to action.
*
* @return void
*/
public function __construct(string $path, ?string $name = null, array $headers = [])
$this->path = $path;
if (! is_null($name)) {
$this->name($name);
}
$this->headers($headers);
public function name(string $name): self
$this->name = $name;
return $this;
public function disk(?string $disk): self
$this->disk = $disk;
public function headers(array $headers): self
$this->headers = $headers;
* Execute Action.
public function run()
return Storage::disk($this->disk)->download($this->path, $this->name, $this->headers);