1 | <?php |
||
12 | class CacheableObserver |
||
13 | { |
||
14 | /** |
||
15 | * The dirty fields of all observed models. |
||
16 | * |
||
17 | * @var \Illuminate\Support\Collection |
||
18 | */ |
||
19 | protected $dirtyFields; |
||
20 | |||
21 | /** |
||
22 | * Class constructor. |
||
23 | * |
||
24 | * @param \Illuminate\Support\Collection $dirtyFields |
||
25 | */ |
||
26 | public function __construct(Collection $dirtyFields) |
||
30 | |||
31 | /** |
||
32 | * Tell the cacheable service to flush all cache |
||
33 | * that related to the given model. |
||
34 | * |
||
35 | * @param \Suitmedia\Cacheable\Contracts\CacheableModel $model |
||
36 | * |
||
37 | * @return void |
||
38 | */ |
||
39 | protected function flushCache(CacheableModel $model) |
||
50 | |||
51 | /** |
||
52 | * Saved event handler. |
||
53 | * |
||
54 | * @param \Suitmedia\Cacheable\Contracts\CacheableModel $model |
||
55 | * |
||
56 | * @return void |
||
57 | */ |
||
58 | public function saved(CacheableModel $model) |
||
62 | |||
63 | /** |
||
64 | * saving event handler. |
||
65 | * |
||
66 | * @param \Suitmedia\Cacheable\Contracts\CacheableModel $model |
||
67 | * |
||
68 | * @return void |
||
69 | */ |
||
70 | public function saving(CacheableModel $model) |
||
74 | |||
75 | /** |
||
76 | * Deleted event handler. |
||
77 | * |
||
78 | * @param \Suitmedia\Cacheable\Contracts\CacheableModel $model |
||
79 | * |
||
80 | * @return void |
||
81 | */ |
||
82 | public function deleted(CacheableModel $model) |
||
86 | |||
87 | /** |
||
88 | * deleting event handler. |
||
89 | * |
||
90 | * @param \Suitmedia\Cacheable\Contracts\CacheableModel $model |
||
91 | * |
||
92 | * @return void |
||
93 | */ |
||
94 | public function deleting(CacheableModel $model) |
||
98 | |||
99 | /** |
||
100 | * Restored event handler. |
||
101 | * |
||
102 | * @param \Suitmedia\Cacheable\Contracts\CacheableModel $model |
||
103 | * |
||
104 | * @return void |
||
105 | */ |
||
106 | public function restored(CacheableModel $model) |
||
110 | |||
111 | /** |
||
112 | * restoring event handler. |
||
113 | * |
||
114 | * @param \Suitmedia\Cacheable\Contracts\CacheableModel $model |
||
115 | * |
||
116 | * @return void |
||
117 | */ |
||
118 | public function restoring(CacheableModel $model) |
||
122 | } |
||
123 |