我的.env文件是:
MAIL_DRIVER=mail
MAIL_HOST=smtp.mandrillapp.com
MAIL_PORT=587
MAIL_USERNAME=sabin.maharjan456@gmail.com
MAIL_PASSWORD=****************************
Run Code Online (Sandbox Code Playgroud)
Mailer.php
<?php namespace App\Http\Controllers;
class Mailer{
public function sendTo($email, $subject, $view, $data = array())
{
\Mail::queue($view, $data, function($message) use($email, $subject)
{
$message->to($email)->subject($subject);
});
return "Mail has been sent";
}
public function welcome($formData)
{
$subject = "User Message was arrived !";
$data['name'] = $formData['name'];
$data['email'] = $formData['email'];
$data['mobile'] = $formData['mobile'];
$data['subject'] = $formData['subject'];
$data['bodymessage'] = $formData['message'];
$view = 'emails.welcome';
return $this->sendTo(['sabin.maharjan456@gmail.com'],$subject,$view,$data);
}
}
Run Code Online (Sandbox Code Playgroud)
位指示:
public function postContactFormRequest(CreateContactFormRequest $request,Mailer $mailer)
{
$formData = $request->all();
$this->mailer->welcome($formData);
} …Run Code Online (Sandbox Code Playgroud) 我在ubuntu 14.04安装了phpstorm错误当我尝试使用命令php artisan migrate访问数据库时:
wwwsabininfonp@wwwsabininfonp-Aspire-E1-471:/opt/lampp/htdocs/fine-arts$ php artisan migrate
[PDOException]
SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
Run Code Online (Sandbox Code Playgroud)
当我尝试使用命令组合器更新后发生以下错误:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- gregwar/captcha dev-master requires ext-gd * -> the requested PHP extension gd is missing from your system.
- gregwar/captcha dev-master requires ext-gd * -> the requested PHP extension gd is missing from your system.
- Installation request for gregwar/captcha dev-master -> satisfiable by gregwar/captcha[dev-master]. …Run Code Online (Sandbox Code Playgroud)