Quantcast
Channel: Active questions tagged email - Stack Overflow
Viewing all articles
Browse latest Browse all 29769

Laravel : Remind user to used module that provided

$
0
0

basically i need to remind the user to used the modules provide by the system. I become little confused because i created new DB table which is $ModuleAutoMail inside the table i have 3 columns which user_id, module_id and last_used_module. So to detect the reminder its should with this follow user_id->module_id->last_used_module .I'm little confused how to implement this. So anyone can help with this?

foreach($ModuleAutoMail as $mod) {
   if($mail->condition_id=='3'){                        
      if( $mod->last_used_module < Carbon::now()->subDays($mail->days)){   
         $ableToSendMail = false;
      }

      if(is_null($mod->last_used_module)){  *//this part i'm not sure*  
         $ableToSendMail = true;
         if ((EmailSave::where('email_id',$email_id)->where('user_id',$user_id)->count()< 1) || (EmailSave::where('email_id',$email_id)->where('user_id',$user_id)->whereDate('created_at', '>', Carbon::now()->addDays(30))->first())){  
            $ableToSendMail = true;
      }

      if ($ableToSendMail) {
         $mails = new EmailSave;
         $mails->user_id = $user->id;
         $mails->email_id =$mail->id;
         Mail::to($user->email)->send(new Automail($mail));
         $mails->save();
      }
   }     
}

Viewing all articles
Browse latest Browse all 29769

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>