*/ public function list(): Collection { return $this->cache->all(); } /** * @param array $data */ public function create(array $data): PaymentMethod { $method = PaymentMethod::create($data); $this->cache->forget(); Event::dispatch(new PaymentMethodCreated($method)); return $method; } /** * @param array $data */ public function update(PaymentMethod $method, array $data): PaymentMethod { $old = $method->only(array_keys($data)); $method->update($data); $this->cache->forget(); Event::dispatch(new PaymentMethodUpdated($method, $old)); return $method; } public function delete(PaymentMethod $method): void { $snapshot = $method->only([ 'id', 'type', 'name', 'driver', 'capture_mode', 'captured_status', 'authorized_status', 'position', 'enabled', ]); $method->delete(); $this->cache->forget(); Event::dispatch(new PaymentMethodDeleted($snapshot)); } }