Completed
Pull Request — master (#41)
by
unknown
02:46
created

RefreshThumbnailCommand::fire()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 0
1
<?php namespace Modules\Media\Console;
2
3
use Illuminate\Console\Command;
4
use Illuminate\Foundation\Bus\DispatchesJobs;
5
use Modules\Media\Jobs\RebuildThumbnails;
6
use Modules\Media\Repositories\FileRepository;
7
8
class RefreshThumbnailCommand extends Command
9
{
10
    use DispatchesJobs;
11
    protected $name = 'asgard:media:refresh';
12
    protected $description = 'Create and or refresh the thumbnails';
13
    /**
14
     * @var FileRepository
15
     */
16
    private $file;
17
18
    public function __construct(FileRepository $file)
19
    {
20
        parent::__construct();
21
        $this->file = $file;
22
    }
23
24
    /**
25
     * Execute the console command.
26
     *
27
     * @return mixed
28
     */
29
    public function fire()
30
    {
31
        $this->line('Preparing to regenerate all thumbnails...');
32
33
        $this->dispatch(new RebuildThumbnails($this->file->all()->pluck('path')));
34
35
        $this->info('All thumbnails refreshed');
36
    }
37
}
38