我想发邮件给非常用户,这是管理员。但这个代码显示我错误Call to undefined method Illuminate\Database\Eloquent\Builder::all()
。所以我怎么能发送每一个管理员的电子邮件消息?
public function index()
{
$user = User::where('role', 'Admin')->all();
$project = [
'greeting' => 'Hi '.$user->login.',',
'body' => 'This is the project assigned to you.',
'thanks' => 'Thank you this is from codeanddeploy.com',
'id' => 1
];
$user->notify(new EmailNotification($project));
return view('customers', [
'customers' => Customer::all()
]);
}
1条答案
按热度按时间0yg35tkg1#
试试这个:
要通知多个用户,请尝试