我有一个findSubmission方法。想象一下,在数组提交中可能有返回值。现在,我将按他们的指数返回。但是我想一个接一个地返回提交的所有值,而不像现在这样使用索引。
public function sponsoring() {
$user = User::find(Auth::user()->id);
return view('profile.sponsoring.index',['user' => Auth::user()]);
}
// In View:
@foreach ($user->kids as $kids)
<p>You are currently sponsoring {{ $kids->first_name }} {{ $kids->last_name }}</p>
@endforeach
答案 0 :(得分:2)
您可以使用:
import org.mockito.AdditionalAnswers;
when(submissionService.findSubmission(Mockito.anyLong())).thenAnswer(AdditionalAnswers.returnsElementsOf(Arrays.asList(submission)));