Answers for "laravel form in email"

PHP
3

email validation in laravel

'email' => 'required|email|unique:users,email',
//@sujay
Posted by: Guest on October-09-2020
0

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');
  }
Posted by: Guest on August-25-2021
0

email validation in laravel

$validator = Validator::make($request->all(), []);

 $validator->sometimes('email', 'unique:users,email', function ($input) {
            return $input->email !== Auth::user()->email;
        });
//@sujay
Posted by: Guest on October-09-2020

Browse Popular Code Answers by Language