diff --git a/be/resources/views/emails/task/sub_task_created.blade.php b/be/resources/views/emails/task/sub_task_created.blade.php index ed59812..6441e1d 100644 --- a/be/resources/views/emails/task/sub_task_created.blade.php +++ b/be/resources/views/emails/task/sub_task_created.blade.php @@ -13,9 +13,31 @@ Odkaz na Task: {{ url( env( 'APP_URL_FE' ) . '/#/app/dashboard/tasks?subtask=' . @php + $description = ($subtask->description) ?: $subtask->mastertask->description; + + // Define regular expressions for Windows and Mac SMB links + $pattern_windows = '/smb:\/\/serverjl[^ ]*/'; + $pattern_mac = '/\\\\serverjl\\\\[^ ]*/'; + + // Define the callback function to replace links + function replace_smb_links($matches) { + $link = $matches[0]; + if (strpos($link, 'smb://serverjl') === 0) { + // Windows link + $windows_link = str_replace('smb://serverjl', '\\\\serverjl\\', $link); + return "
Windows: $windows_link
Mac: $link
"; + } elseif (strpos($link, '\\\\serverjl\\') === 0) { + // Mac link + $mac_link = str_replace('\\\\serverjl\\', 'smb://serverjl', $link); + return "
Windows: $link
Mac: $mac_link
"; + } + return $link; // In case no pattern matches, return the original link + } + + // Replace SMB links using the callback function + $description = preg_replace_callback($pattern_windows, 'replace_smb_links', $description); + $description = preg_replace_callback($pattern_mac, 'replace_smb_links', $description); - $test = 'testtesttest'; @endphp -Popis: {!!($subtask->description) ?: $subtask->mastertask->description !!}
-Popis2: {{$test}}
+Popis: {!!$description!!}
diff --git a/be/routes/web.php b/be/routes/web.php index 3c1aed4..33e21fe 100644 --- a/be/routes/web.php +++ b/be/routes/web.php @@ -1,7 +1,6 @@ find(1622); + + Mail::to('feher@studiotem.com')->send(new NewTask($subtask)); + + return 'Email has been sent'; +}); + + Route::prefix('be')->group(function () { Route::get('/unauthenticated', function () { return response()->json([ @@ -30,7 +38,6 @@ Route::prefix('be')->group(function () { $subtask = \App\Models\SubTask::with('mastertask')->find(1); dd($subtask); - }); });