mostafaznv /
laracache
| 1 | <?php |
||
| 2 | |||
| 3 | namespace Mostafaznv\LaraCache\Jobs; |
||
| 4 | |||
| 5 | use Illuminate\Bus\Queueable; |
||
| 6 | use Illuminate\Contracts\Queue\ShouldQueue; |
||
| 7 | use Illuminate\Foundation\Bus\Dispatchable; |
||
| 8 | use Illuminate\Queue\InteractsWithQueue; |
||
| 9 | use Illuminate\Queue\SerializesModels; |
||
| 10 | use Mostafaznv\LaraCache\DTOs\CacheEvent; |
||
| 11 | |||
| 12 | class RefreshCache implements ShouldQueue |
||
| 13 | { |
||
| 14 | use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; |
||
|
0 ignored issues
–
show
introduced
by
Loading history...
|
|||
| 15 | |||
| 16 | public function __construct( |
||
| 17 | private string $model, |
||
| 18 | private string $name, |
||
| 19 | private CacheEvent $event |
||
| 20 | ) {} |
||
| 21 | |||
| 22 | public function handle(): void |
||
| 23 | { |
||
| 24 | $model = app($this->model); |
||
| 25 | |||
| 26 | $model->cache()->update($this->name, $this->event); |
||
| 27 | } |
||
| 28 | } |
||
| 29 |