Md.Mostafijur Rahman 1 year ago
parent
commit
6c0f3f8324

+ 31 - 0
app/Helpers/functions.php

@@ -154,5 +154,36 @@ if(!function_exists('profile_permission')){
 	}
 	}
 } 
 } 
 
 
+
+function local_tz(\App\User $user=NULL, $default='UTC'){
+
+    if(empty($user)) $user=\Auth::user();
+
+    if($user && $user->last_timezone){
+        return $user->last_timezone;
+    }
+
+    return $default;
+
+}
+
+function utc_to_ltz($time_str, $format='d M Y g:i A', $tz=NULL){
+
+    if(empty($tz)) $tz=local_tz();
+
+    return \Carbon\Carbon::parse(
+        $time_str
+    )->setTimezone($tz)->format($format);
+
+}
+
+function lt_to_utc($time_str, $tz='Asia/Dhaka'){
+
+    return \Carbon\Carbon::parse(
+        $time_str, $tz
+    )->setTimezone('UTC');
+    
+}
+
  
  
  
  

+ 26 - 2
app/Http/Controllers/ModalController.php

@@ -73,16 +73,40 @@ class ModalController extends Controller{
             $student_proposal->student_apply_ref =studentRefNoGenerate();
             $student_proposal->student_apply_ref =studentRefNoGenerate();
             $student_proposal->save(); 
             $student_proposal->save(); 
 
 
-            $user =User::find($req->id);
+            $user =User::find($student_proposal->student_id);
+            $proposal_user =User::find($student_proposal->teacher_id);
+            
 			 if($user){
 			 if($user){
 				$data['name'] = $user->first_name.' '.$user->last_name;  
 				$data['name'] = $user->first_name.' '.$user->last_name;  
+				$data['teacher'] = $proposal_user->first_name.' '.$proposal_user->last_name;  
+				$data['arn'] = $proposal_user->ref_no;  
 				$user_mail =$user->email;
 				$user_mail =$user->email;
 				$from = 'test@mail.com'; 
 				$from = 'test@mail.com'; 
-				Mail::send('email.send_apply_student_teacher_email',$data, function ($message) use ($user_mail,$from) {
+				Mail::send('email.student_proposal_email',$data, function ($message) use ($user_mail,$from) {
 					$message->from($from);
 					$message->from($from);
 					$message->to($user_mail)->subject('New Email Send to you');
 					$message->to($user_mail)->subject('New Email Send to you');
 				});
 				});
 			 }
 			 }
+
+             $proposal =Proposal::where(
+                    'student_id',$student_proposal->student_id
+                )->where(
+                    'id',$student_proposal->proposal_id
+                )->first();
+
+             if($proposal_user){
+                $data['name'] = $proposal_user->first_name.' '.$proposal_user->last_name;  
+                $data['std_name'] = $user->first_name.' '.$user->last_name; 
+                $data['proposal_title'] =$proposal->title; 
+                $data['date_time']=$student_proposal->created_at;
+				$user_mail =$proposal_user->email;
+				$from = 'test@mail.com'; 
+				Mail::send('email.teacher_proposal_email',$data, function ($message) use ($user_mail,$from) {
+					$message->from($from);
+					$message->to($user_mail)->subject('New Email Send to you');
+				});
+             }
+
            
            
             return response(['msg'=>'Proposal send successfully.']);
             return response(['msg'=>'Proposal send successfully.']);
 
 

+ 20 - 19
composer.lock

@@ -118,16 +118,16 @@
         },
         },
         {
         {
             "name": "aws/aws-sdk-php",
             "name": "aws/aws-sdk-php",
-            "version": "3.262.3",
+            "version": "3.263.0",
             "source": {
             "source": {
                 "type": "git",
                 "type": "git",
                 "url": "https://github.com/aws/aws-sdk-php.git",
                 "url": "https://github.com/aws/aws-sdk-php.git",
-                "reference": "f5c8142d43846194bbb3bb40b18e7f6df2788409"
+                "reference": "a0a528cb8e22dd0113f97ad0df527a6db32fe061"
             },
             },
             "dist": {
             "dist": {
                 "type": "zip",
                 "type": "zip",
-                "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/f5c8142d43846194bbb3bb40b18e7f6df2788409",
-                "reference": "f5c8142d43846194bbb3bb40b18e7f6df2788409",
+                "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/a0a528cb8e22dd0113f97ad0df527a6db32fe061",
+                "reference": "a0a528cb8e22dd0113f97ad0df527a6db32fe061",
                 "shasum": ""
                 "shasum": ""
             },
             },
             "require": {
             "require": {
@@ -206,9 +206,9 @@
             "support": {
             "support": {
                 "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80",
                 "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80",
                 "issues": "https://github.com/aws/aws-sdk-php/issues",
                 "issues": "https://github.com/aws/aws-sdk-php/issues",
-                "source": "https://github.com/aws/aws-sdk-php/tree/3.262.3"
+                "source": "https://github.com/aws/aws-sdk-php/tree/3.263.0"
             },
             },
-            "time": "2023-03-28T18:18:50+00:00"
+            "time": "2023-03-30T18:22:31+00:00"
         },
         },
         {
         {
             "name": "brick/math",
             "name": "brick/math",
@@ -2525,16 +2525,16 @@
         },
         },
         {
         {
             "name": "psy/psysh",
             "name": "psy/psysh",
-            "version": "v0.11.12",
+            "version": "v0.11.14",
             "source": {
             "source": {
                 "type": "git",
                 "type": "git",
                 "url": "https://github.com/bobthecow/psysh.git",
                 "url": "https://github.com/bobthecow/psysh.git",
-                "reference": "52cb7c47d403c31c0adc9bf7710fc355f93c20f7"
+                "reference": "8c2e264def7a8263a68ef6f0b55ce90b77d41e17"
             },
             },
             "dist": {
             "dist": {
                 "type": "zip",
                 "type": "zip",
-                "url": "https://api.github.com/repos/bobthecow/psysh/zipball/52cb7c47d403c31c0adc9bf7710fc355f93c20f7",
-                "reference": "52cb7c47d403c31c0adc9bf7710fc355f93c20f7",
+                "url": "https://api.github.com/repos/bobthecow/psysh/zipball/8c2e264def7a8263a68ef6f0b55ce90b77d41e17",
+                "reference": "8c2e264def7a8263a68ef6f0b55ce90b77d41e17",
                 "shasum": ""
                 "shasum": ""
             },
             },
             "require": {
             "require": {
@@ -2595,9 +2595,9 @@
             ],
             ],
             "support": {
             "support": {
                 "issues": "https://github.com/bobthecow/psysh/issues",
                 "issues": "https://github.com/bobthecow/psysh/issues",
-                "source": "https://github.com/bobthecow/psysh/tree/v0.11.12"
+                "source": "https://github.com/bobthecow/psysh/tree/v0.11.14"
             },
             },
-            "time": "2023-01-29T21:24:40+00:00"
+            "time": "2023-03-28T03:41:01+00:00"
         },
         },
         {
         {
             "name": "ralouphie/getallheaders",
             "name": "ralouphie/getallheaders",
@@ -6428,16 +6428,16 @@
         },
         },
         {
         {
             "name": "phpunit/phpunit",
             "name": "phpunit/phpunit",
-            "version": "9.6.5",
+            "version": "9.6.6",
             "source": {
             "source": {
                 "type": "git",
                 "type": "git",
                 "url": "https://github.com/sebastianbergmann/phpunit.git",
                 "url": "https://github.com/sebastianbergmann/phpunit.git",
-                "reference": "86e761949019ae83f49240b2f2123fb5ab3b2fc5"
+                "reference": "b65d59a059d3004a040c16a82e07bbdf6cfdd115"
             },
             },
             "dist": {
             "dist": {
                 "type": "zip",
                 "type": "zip",
-                "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/86e761949019ae83f49240b2f2123fb5ab3b2fc5",
-                "reference": "86e761949019ae83f49240b2f2123fb5ab3b2fc5",
+                "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/b65d59a059d3004a040c16a82e07bbdf6cfdd115",
+                "reference": "b65d59a059d3004a040c16a82e07bbdf6cfdd115",
                 "shasum": ""
                 "shasum": ""
             },
             },
             "require": {
             "require": {
@@ -6510,7 +6510,8 @@
             ],
             ],
             "support": {
             "support": {
                 "issues": "https://github.com/sebastianbergmann/phpunit/issues",
                 "issues": "https://github.com/sebastianbergmann/phpunit/issues",
-                "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.5"
+                "security": "https://github.com/sebastianbergmann/phpunit/security/policy",
+                "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.6"
             },
             },
             "funding": [
             "funding": [
                 {
                 {
@@ -6526,7 +6527,7 @@
                     "type": "tidelift"
                     "type": "tidelift"
                 }
                 }
             ],
             ],
-            "time": "2023-03-09T06:34:10+00:00"
+            "time": "2023-03-27T11:43:46+00:00"
         },
         },
         {
         {
             "name": "sebastian/cli-parser",
             "name": "sebastian/cli-parser",
@@ -7552,5 +7553,5 @@
         "php": "^7.2.5|^8.0"
         "php": "^7.2.5|^8.0"
     },
     },
     "platform-dev": [],
     "platform-dev": [],
-    "plugin-api-version": "2.0.0"
+    "plugin-api-version": "2.3.0"
 }
 }

+ 3 - 3
resources/views/email/student_proposal_email.blade.php

@@ -80,15 +80,15 @@
                         <div class="col-md-9">
                         <div class="col-md-9">
                             <div class="card rounded border-0 shadow p-5" style="background-color:white;">
                             <div class="card rounded border-0 shadow p-5" style="background-color:white;">
                                 <h3 style="text-align: center; font-family:Ubuntu !important; color: #3c4858 !important; font-size: 30px !important;">Research Admission</h3>
                                 <h3 style="text-align: center; font-family:Ubuntu !important; color: #3c4858 !important; font-size: 30px !important;">Research Admission</h3>
-                                <p class="mt-5">Dear Applicant,</p>
+                                <p class="mt-5">Dear {{ $name }},</p>
                                     <p class="mt-3">I hope this email finds you well. </p>
                                     <p class="mt-3">I hope this email finds you well. </p>
                                     <p class="mt-2">I appreciate your initiative to contact me regarding your research admission interest. To proceed further, I would request you to please submit your research proposal using the following link</p>
                                     <p class="mt-2">I appreciate your initiative to contact me regarding your research admission interest. To proceed further, I would request you to please submit your research proposal using the following link</p>
                                     <a href="">[insert link here]. </a>
                                     <a href="">[insert link here]. </a>
                                     <p class="mt-2">The portal will guide you through the submission process and provide you with all the necessary information required for your submission. It will provide you with real-time updates on the status of your proposal as well.</p>
                                     <p class="mt-2">The portal will guide you through the submission process and provide you with all the necessary information required for your submission. It will provide you with real-time updates on the status of your proposal as well.</p>
-                                    <p class="mt-2">In case you face any issues during the submission process, please use my Account Reference Number (ARN) 123456 and submit your proposal. This will ensure that your proposal reaches to me without any delay or technical difficulty.</p>
+                                    <p class="mt-2">In case you face any issues during the submission process, please use my Account Reference Number (ARN) {{ $arn }} and submit your proposal. This will ensure that your proposal reaches to me without any delay or technical difficulty.</p>
                                     <p class="mt-2">I am looking forward to reviewing your research proposal and I hope to hear from you soon. If you have any further questions, please do not hesitate to contact me.</p>
                                     <p class="mt-2">I am looking forward to reviewing your research proposal and I hope to hear from you soon. If you have any further questions, please do not hesitate to contact me.</p>
                                     <p class="mt-2" style="margin: 0px;">Best regards,</p>
                                     <p class="mt-2" style="margin: 0px;">Best regards,</p>
-                                    <h6>Teacher</h6>
+                                    <h6>{{ $teacher }}</h6>
                                      <div style="border-top: 1px solid #eee;">
                                      <div style="border-top: 1px solid #eee;">
                                         <p class="mt-3 tmail" style="font-style: italic;">This email was sent to example@gmail.com</p>
                                         <p class="mt-3 tmail" style="font-style: italic;">This email was sent to example@gmail.com</p>
                                     </div>
                                     </div>

+ 4 - 4
resources/views/email/teacher_proposal_email.blade.php

@@ -80,11 +80,11 @@
                         <div class="col-md-9">
                         <div class="col-md-9">
                             <div class="card rounded border-0 shadow p-5" style="background-color:white;">
                             <div class="card rounded border-0 shadow p-5" style="background-color:white;">
                                 <h3 style="text-align: center; font-family:Ubuntu !important; color: #3c4858 !important; font-size: 30px !important;">Research Admission</h3>
                                 <h3 style="text-align: center; font-family:Ubuntu !important; color: #3c4858 !important; font-size: 30px !important;">Research Admission</h3>
-                                <p class="mt-5">Dear [Teacher's Name],</p>
+                                <p class="mt-5">Dear {{ $name }},</p>
                                 <p class="mt-3">This is to notify you that a new proposal has been received and is awaiting your review from the following applicant: </p>
                                 <p class="mt-3">This is to notify you that a new proposal has been received and is awaiting your review from the following applicant: </p>
-                                <span>Student Name:</span>
-                                <span>Proposal Title:</span>
-                                <span>Submission Date: {date} {time} (teacher’s local time)</span>
+                                <span>Student Name:  {{ $std_name }}</span>
+                                <span>Proposal Title: {{ $proposal_title }}</span>
+                                <span>Submission Date: {{ utc_to_ltz(local_tz(), $date_time, 'M d, Y')}}</span>
                                 <p class="mt-2"> To access the proposal, please log in to your account and navigate to the application section.</p>
                                 <p class="mt-2"> To access the proposal, please log in to your account and navigate to the application section.</p>
                                 <p class="mt-2" style="margin: 0px;">Best regards,</p>
                                 <p class="mt-2" style="margin: 0px;">Best regards,</p>
                                 <h6>Research Admission Team</h6>
                                 <h6>Research Admission Team</h6>