RefreshCache::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 0
c 1
b 0
f 0
dl 0
loc 5
rs 10
cc 1
nc 1
nop 3
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
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