Skip to content

Commit

Permalink
Reading config and setting disk in ClydeUpload class
Browse files Browse the repository at this point in the history
  • Loading branch information
antennaio committed Jan 22, 2016
1 parent 76b77a8 commit 1bdb3bd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
5 changes: 1 addition & 4 deletions src/ClydeServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,7 @@ public function register()
});

$this->app->bind('laravel-clyde-upload', function ($app) {
$clydeUpload = $app->make(ClydeUpload::class);
$clydeUpload->setDisk(config('clyde.source'));

return $clydeUpload;
return $app->make(ClydeUpload::class);
});
}
}
14 changes: 11 additions & 3 deletions src/ClydeUpload.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,18 @@

namespace Antennaio\Clyde;

use Illuminate\Config\Repository as Config;
use Illuminate\Contracts\Filesystem\Factory as Filesystem;
use Illuminate\Contracts\Filesystem\FilesystemAdapter;
use Symfony\Component\HttpFoundation\File\UploadedFile;

class ClydeUpload
{
/**
* @var Config
*/
protected $config;

/**
* @var Filesystem
*/
Expand All @@ -26,15 +32,17 @@ class ClydeUpload
/**
* Create a new ClydeUpload instance.
*
* @param Config $config
* @param Filesystem $files
* @param FilenameGenerator $filename
*/
public function __construct(Filesystem $files, FilenameGenerator $filename)
public function __construct(Config $config, Filesystem $files, FilenameGenerator $filename)
{
$this->config = $config;
$this->files = $files;
$this->filename = $filename;

$this->setDisk('local');
$this->setDisk($this->config->get('clyde.source'));
}

/**
Expand Down Expand Up @@ -74,7 +82,7 @@ public function remove($filename)
*/
protected function buildPath($filename)
{
return config('clyde.source_path_prefix') . DIRECTORY_SEPARATOR . $filename;
return $this->config->get('clyde.source_path_prefix') . DIRECTORY_SEPARATOR . $filename;
}

/**
Expand Down

0 comments on commit 1bdb3bd

Please sign in to comment.