Conditions | 2 |
Paths | 2 |
Total Lines | 17 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php namespace GeneaLabs\LaravelModelCaching\Console\Commands; |
||
32 | protected function flushModelCache(string $option) : int |
||
33 | { |
||
34 | $model = new $option; |
||
35 | $usesCachableTrait = collect(class_uses($model)) |
||
36 | ->contains("GeneaLabs\LaravelModelCaching\Traits\Cachable"); |
||
37 | |||
38 | if (! $usesCachableTrait) { |
||
39 | $this->error("'{$option}' is not an instance of CachedModel."); |
||
40 | $this->line("Only CachedModel instances can be flushed."); |
||
41 | |||
42 | return 1; |
||
43 | } |
||
44 | |||
45 | $model->flushCache(); |
||
46 | $this->info("✔︎ Cache for model '{$option}' has been flushed."); |
||
47 | |||
48 | return 0; |
||
49 | } |
||
51 |