错误异常 : 未定义的变量: 天

用户邮箱存储库


我希望这些天应该在addDays()中添加日期,我将得到我的数据库


public function create() 

    {


        $users = User::where('user_type', 2)->get();

        $auto_email_templates=AutoEmailTemplate::all()->pluck('days');



        foreach ($users as $user) {


           if( $user->created_at > Carbon::now()->addDays($days)){

                if ($user->created_at < Carbon::now()) //signup

                {    

                    return false;

                }

                    Mail::to($user)->send(new Automail($template));

                    return true;


           }

}


波斯汪
浏览 72回答 1
1回答

慕慕森

&nbsp; public function create()&nbsp;&nbsp; &nbsp; {&nbsp; &nbsp; &nbsp; &nbsp; $users = User::where('user_type', 2)->get();&nbsp; &nbsp; &nbsp; &nbsp; $auto_email_templates=AutoEmailTemplate::all();&nbsp; &nbsp; &nbsp; &nbsp; foreach ($users as $user) {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; foreach($auto_email_templates as $mail){&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if( $user->created_at > Carbon::now()->addDays($mail->days)){&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if ($user->created_at < Carbon::now()) //signup&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return false;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Mail::to($user)->send(new Automail($template));&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return true;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }
打开App,查看更多内容
随时随地看视频慕课网APP