email validation in laravel
'email' => 'required|email|unique:users,email',
//@sujay
email validation in laravel
'email' => 'required|email|unique:users,email',
//@sujay
laravel send email
// admin.newsletters.send_email : is the blade that will have your email content
// 'newsletter' => $newsletter : is the collection to be used in the blade file
// function ($message) : the function email and the variable to be used in the message.
// use ($newsletter) : is the collection to be used in the message controller (e.g $message->to($newsletter->email))
// Swift_TransportException to check if it is real email
namespace App\Http\Controllers\Admin;
use Mail;
public function sendEmail(Newsletter $newsletter)
{
try {
Mail::send('admin.newsletters.send_email', ['newsletter' => $newsletter], function ($message) use ($newsletter) {
$message->from('[email protected]', 'eee-services.com');
$message->to('[email protected]')->subject('Newsletter');
});
} catch (\Swift_TransportException $e) {
if ($e->getMessage()) {
return redirect()->route('admin.newsletters.index');
}
}
return redirect()->route('admin.newsletters.index');
}
email validation in laravel
$validator = Validator::make($request->all(), []);
$validator->sometimes('email', 'unique:users,email', function ($input) {
return $input->email !== Auth::user()->email;
});
//@sujay
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us