如何将多个文件附加到laravel 5.3 mailable?
我可以使用->attach($form->filePath)我的mailable构建方法轻松地附加单个文件.但是,当我将表单字段更改为数组时,我收到以下错误:
basename() expects parameter 1 to be string, array given
Run Code Online (Sandbox Code Playgroud)
我在堆栈上搜索文档和各种搜索术语无济于事.任何帮助将不胜感激.
构建方法:
public function build()
{
return $this->subject('Employment Application')
->attach($this->employment['portfolio_samples'])
->view('emails.employment_mailview');
}
Run Code Online (Sandbox Code Playgroud)
控制器的邮件呼叫:
Mail::to(config('mail.from.address'))->send(new Employment($employment));
Run Code Online (Sandbox Code Playgroud) 如何使用Laravel链接到视图中的特定ID?
我的控制器:
public function services() {
return View::make('services.custom_paint', array('pageTitle' => 'Custom Paint'))->with('default_title', $this->default_title);
}
Run Code Online (Sandbox Code Playgroud)
我的路线:
Route::get('/custom_paint', 'PagesController@services');
Run Code Online (Sandbox Code Playgroud)
我试图添加#id到路由,控制器,甚至视图URL::to.似乎没什么用.
我假设只是将id添加到URI就可以了,但显然我错过了一些东西.
我想知道是否有办法让POST数组的值作为字符串以外的东西返回?
所以,例如,如果我想:
foreach ($_POST as $key => $value)
{
if (is_X($value)) // X being int or bool or string, etc....
{
do something.....
}
}
Run Code Online (Sandbox Code Playgroud)
我开始考虑可能settype($var, "type")
但是,我必须明确设置每个输入的类型,这似乎是一个荒谬的方式来解决这个问题.