Fewo/ PDFs / Mails v3

This commit is contained in:
Kevin Adametz 2019-05-06 20:21:40 +02:00
parent 7abfe3f700
commit e537e47a82
44 changed files with 2112 additions and 527 deletions

View file

@ -62,15 +62,44 @@ Route::get('/user/update_email_confirm/{token}', 'UserUpdateEmailController@acti
Route::group(['middleware' => ['auth']], function()
{
Route::get('storage/{type?}/{file?}', function($type = null, $file = null)
{
if($type == 'xls'){
Route::get('storage/{type?}/{class?}/{year?}/{file?}/{do?}', function($type = null, $class = null, $year = null, $file = null, $do = null) {
/*if ($type == 'xls') {
$path = storage_path("app/export/");
$filename = $file.'.xls';
$filename = $file . '.xls';
}*/
$path = "";
$filename = "";
$headers = [];
if ($class == 'invoices'){
if ($type == 'fewo') {
$headers = array('Content-Type: application/pdf',);
$dir = $year."/";
$filename = $file;
if(Storage::disk('fewo_invoices')->exists( $dir.$filename )){
$path = Storage::disk('fewo_invoices')->path($dir.$filename);
}
}
}
if (file_exists($path.$filename)) {
return Response::download($path.$filename, $filename);
if ($class == 'infos'){
if ($type == 'fewo') {
$headers = array('Content-Type: application/pdf',);
$dir = $year."/";
$filename = $file;
if(Storage::disk('fewo_infos')->exists( $dir.$filename )){
$path = Storage::disk('fewo_infos')->path($dir.$filename);
}
}
}
if (file_exists($path)) {
if($do == "download"){
return Response::download($path, $filename, $headers);
}
if($do == "file"){
return Response::file($path, $headers);
}
}
})->name('storage');
@ -257,18 +286,17 @@ Route::group(['middleware' => ['superadmin']], function() {
});
/*
use App\Mail\MailResetPassword;
Route::get('/send_test_email', function(){
try {
Mail::to('kevin.adametz@me.com')->send(new MailResetPassword('asdasd', Auth::user()));
//Mail::to('kevin.adametz@me.com')->send(new MailResetPassword('asdasd', Auth::user()));
Mail::raw('Sending emails with Mailgun and Laravel is easy!', function($message) {
$message->to('kevin.adametz@me.com', 'Kevin Adametz');
$message->subject('testing Networktrips');
});
Mail::raw('Sending emails with Mailgun and Laravel is easy!', function($message) {
$message->to('kevin.adametz@me.com', 'Kevin Adametz');
$message->subject('testing Networktrips');
});
@ -277,8 +305,9 @@ Route::get('/send_test_email', function(){
}
$fail = Mail::failures();
dd($fail);
if(!empty($fail)) throw new \Exception('Could not send message to '.$fail[0]);
if(!empty($fail)) throw new \Exception('Could not send message to '.$fail[0]);
});
*/