#laravel #file #email #ms-word #.doc
#laravel #файл #Адрес электронной почты #ms-word #.doc
Вопрос:
public function wordExport($ticket_id)
{
$icon=Ticket::findOrFail($ticket_id)->icon;
$contact=Icon::findOrFail($icon->id)->contact;
$ticket=Ticket::findOrFail($ticket_id);
$wordFile=new TemplateProcessor('word/Notice of Intention to Appear.docx');
$name=$contact->first_name." ".$contact->last_name;
$wordFile->setValue('name',$name );
$wordFile->setValue('address',$contact->address);
$wordFile->setValue('province',$contact->province);
$wordFile->setValue('postal_code',$contact->postal_code);
$wordFile->setValue('ticket_no',$ticket->ticket_no);
$wordFile->setValue('icon_code',$ticket->icon_code);
$wordFile->setValue('date',$icon->date);
$wordFile->setValue('email',$contact->email);
$wordFile->setValue('city',$contact->city);
$wordFile->setValue('phone',$contact->phone);
$wordFile->setValue('currentDate', date("Y-m-d"));
$wordFile->setImageValue('ticketimage',array('path' =>public_path().'/uploads/file/'.$ticket->images_name , 'width' => 600, 'height' => 900, 'ratio' => true));
$wordFile->setValue('interpreter',$icon->interpreter);
$fileName=$contact->first_name.date("mdY").time();
$wordFile->saveAs($fileName.'.docx');
return response()->download($fileName.'.docx')->deleteFileAfterSend(true);
}
Этот код генерирует файл Word, но я хочу сохранить его по определенному пути или отправить этот файл в виде вложения электронной почты.