1 | <?php |
||
2 | |||
3 | namespace Spatie\Varnish\Commands; |
||
4 | |||
5 | use Illuminate\Console\Command; |
||
6 | use Spatie\Varnish\Varnish; |
||
7 | |||
8 | class FlushVarnishCache extends Command |
||
9 | { |
||
10 | /** |
||
11 | * The console command name. |
||
12 | * |
||
13 | * @var string |
||
14 | */ |
||
15 | protected $signature = 'varnish:flush {url?}'; |
||
16 | |||
17 | /** |
||
18 | * The console command description. |
||
19 | * |
||
20 | * @var string |
||
21 | */ |
||
22 | protected $description = 'Flush the varnish cache. Optionally you can provide a regex of an url you want to flush, e.g. /nl/*.'; |
||
23 | |||
24 | /** |
||
25 | * Execute the console command. |
||
26 | * |
||
27 | * @return mixed |
||
28 | */ |
||
29 | public function handle() |
||
30 | { |
||
31 | $url = $this->argument('url'); |
||
32 | |||
33 | (new Varnish())->flush(null, $url); |
||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
34 | |||
35 | $this->comment('The varnish cache has been flushed!'); |
||
36 | } |
||
37 | } |
||
38 |