Method to send a weekly email to all users in Laravel

B

Boris Winter

Guest
I have currently set up this mailable.

Controller

class EmailController extends Controller
{
public function sendMail ()
{
$user = auth()->User::all();
Mail::to($user)->send(new WeeklyUpdate($user));

if(Mail::faillures())
{
return response()->Fail('Fail');
}
else
{
return response()->Success('Succses');
}
}


Mail class

class WeeklyUpdate extends Mailable
{
use Queueable, SerializesModels;

/**
* Create a new message instance.
*
* @return void
*/
public function __construct()
{
//
}

/**
* Build the message.
*
* @return $this
*/
public function build()
{
return $this->view('email.WeeklyUpdate');
}


How could I start with setting this up that, for instance, all users will get that weeklyUpdate email every sunday evening. I did do some research but only found partial explanations and since I am novice at Laravel, I would like some guidance as where to start with undertaking this.

Continue reading...
 
Top