解析数据时出错:未定义的变量:缅甸人
我确实从我的命令解析数据,在此之前,它获取该数据。当我想再做一次时,它就变成了一个错误。
我得到:
Undefined variable: mystudents (View: /home/john/Documents/api4/api4/resources/views/emails/welcome.blade.php)`enter code here`
这是我的命令代码:
foreach ($student as $mystudent) {
$user = User::find($mystudent->user_id);
Mail::to($user)->send(new WelcomeMail($mystudent));
}
Mail::to($user)->send(new WelcomeMail($student));
echo "check email";
这是我的视图代码
@foreach ($mystudents as $student)
<tr>
<td>{{ $student->student_id }}</td>
<td>{{ $student->name }}</td>
<td>{{ $student->email }}</td>
<td>{{ $student->phone }}</td>
我不确定我的代码是否正确。希望你能帮助我,先生。
I do parsing data from my command, before this, it gets that data. When I want to do it again, it becomes an error.
I got:
Undefined variable: mystudents (View: /home/john/Documents/api4/api4/resources/views/emails/welcome.blade.php)`enter code here`
this is my code on command:
foreach ($student as $mystudent) {
$user = User::find($mystudent->user_id);
Mail::to($user)->send(new WelcomeMail($mystudent));
}
Mail::to($user)->send(new WelcomeMail($student));
echo "check email";
this is my code on view
@foreach ($mystudents as $student)
<tr>
<td>{{ $student->student_id }}</td>
<td>{{ $student->name }}</td>
<td>{{ $student->email }}</td>
<td>{{ $student->phone }}</td>
I'm not sure that my code was correct. Hopefully, you help me, sir.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您正在命令以及视图中运行
foreach
循环。此外,您还调用了 Mail
send
方法两次。我认为你只需要在你的命令中使用一次 foreach :
你认为的代码可以是这样的:
You are running a
foreach
loop in your command, as well as in your view.Also, you are calling the Mail
send
method two times.I think you only need a foreach once, in your command:
The code in your view can be something like this: