*/ public function toArray($request) { // By default we want this collection to not return the secret. // The underlying TwoFAccountReadResource hides the secret only when withSecret == false. // When withSecret is provided the underlying resource will return secret according to the parameter value // If no withSecret is set we force it to false to ensure the secret will not being returned. if (! $request->has('withSecret')) { $request->merge(['withSecret' => false]); } // Here we add a timestamp to the request if OTPs have to be in the response. // The 'at' parameter is used by the TwoFAccountReadResource class to obtain // all OTPs at the same timestamps if ($request->has('withOtp')) { $request->merge(['at' => now()->timestamp]); } return $this->collection; } }