Issues (9)

src/Jobs/RefreshCache.php (1 issue)

Severity
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
The trait Illuminate\Queue\SerializesModels requires some properties which are not provided by Mostafaznv\LaraCache\Jobs\RefreshCache: $collectionClass, $id, $relations, $class, $keyBy
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