firstOrNew([ 'user_id' => $user->id, 'method' => $method ]); $mfaVal->setValue($value); $mfaVal->save(); } /** * Decrypt the value attribute upon access. */ public function getValue(): string { return decrypt($this->value); } /** * Encrypt the value attribute upon access. */ public function setValue($value): void { $this->value = encrypt($value); } }