Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/82.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php ErrorException:未定义变量:天_Php_Sql_Laravel_Laravel 5_Eloquent - Fatal编程技术网

Php ErrorException:未定义变量:天

Php ErrorException:未定义变量:天,php,sql,laravel,laravel-5,eloquent,Php,Sql,Laravel,Laravel 5,Eloquent,UsermailRespoitory 我想在addDays()中添加天数 我将从我的数据库中获取frm的日子 public function create() { $users = User::where('user_type', 2)->get(); $auto_email_templates=AutoEmailTemplate::all()->pluck('days'); foreach ($users as $us

UsermailRespoitory

我想在addDays()中添加天数 我将从我的数据库中获取frm的日子

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;

           }
}
公共函数创建()
{
$users=User::where('User_type',2)->get();
$auto_email_templates=AutoEmailTemplate::all()->pull('days');
foreach($users作为$user){
如果($user->created_at>Carbon::now()->addDays($days)){
如果($user->created_at发送(新的自动邮件($template));
返回true;
}
}
公共函数创建()
{
$users=User::where('User_type',2)->get();
$auto_email_templates=AutoEmailTemplate::all();
foreach($users作为$user){
foreach($auto_email_模板为$mail){
如果($user->created_at>Carbon::now()->addDays($mail->days)){
如果($user->created_at发送(新的自动邮件($template));
返回true;
}
如果($user->created_at>Carbon::now()->addDays($days)){
没有days变量>“我希望天数应该添加到addDays()我将从我的数据库获取frm的天数”中,那么就这样做吧……
$days=//但是你可以从数据库中获取天数
  public function create() 
    {

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


        foreach ($users as $user) {
            foreach($auto_email_templates as $mail){

                if( $user->created_at > Carbon::now()->addDays($mail->days)){
                        if ($user->created_at < Carbon::now()) //signup
                        {    
                            return false;
                        }
                            Mail::to($user)->send(new Automail($template));
                            return true;

                }