This commit is contained in:
baghizadizn 2025-11-29 12:57:03 +07:00
parent a6efc67883
commit 24405c69f1
5 changed files with 22 additions and 17 deletions

View File

@ -122,9 +122,6 @@ class RegisteredUserController extends Controller
// Log the user in after successful registration // Log the user in after successful registration
Auth::login($user); Auth::login($user);
//send notification to user
$application = Application::max('id') + 1;
$user->notify(new \App\Notifications\InstructorApplicant($application));
return redirect(RouteServiceProvider::HOME); return redirect(RouteServiceProvider::HOME);
} catch (\Exception $e) { } catch (\Exception $e) {
@ -208,6 +205,9 @@ class RegisteredUserController extends Controller
'description' => $request->description 'description' => $request->description
]; ];
//send notification to user
$user->notify(new \App\Notifications\InstructorApplicant($application));
// Create both application and instructor records // Create both application and instructor records
Application::create($application); Application::create($application);
Instructors::create($instructor); Instructors::create($instructor);

View File

@ -73,12 +73,6 @@ class BecomeInstructorController extends Controller
DB::commit(); DB::commit();
// Get the latest application and send notification
$application = Application::max('id') + 1;
if ($application) {
$user->notify(new \App\Notifications\InstructorApplicant($application));
}
Session::flash('success', get_phrase('Your application has been submitted successfully.')); Session::flash('success', get_phrase('Your application has been submitted successfully.'));
return redirect(RouteServiceProvider::HOME); return redirect(RouteServiceProvider::HOME);
@ -160,7 +154,7 @@ class BecomeInstructorController extends Controller
Log::info('Instructor data to be saved:', $instructorData); Log::info('Instructor data to be saved:', $instructorData);
// Prepare application data - INCLUDING DOCUMENT PATH // Prepare application data - INCLUDING DOCUMENT PATH
$applicationData = [ $application = [
'user_id' => $user->id, 'user_id' => $user->id,
'nidn' => $nidn, 'nidn' => $nidn,
'phone' => $request->phone, 'phone' => $request->phone,
@ -169,10 +163,13 @@ class BecomeInstructorController extends Controller
'status' => 0 'status' => 0
]; ];
Log::info('Application data to be saved:', $applicationData); //send notification to user
$user->notify(new \App\Notifications\InstructorApplicant($application));
Log::info('Application data to be saved:', $application);
// Create both application and instructor records // Create both application and instructor records
Application::create($applicationData); Application::create($application);
Instructors::create($instructorData); Instructors::create($instructorData);
return redirect()->back(); // This return won't be used due to the try-catch structure return redirect()->back(); // This return won't be used due to the try-catch structure

View File

@ -37,7 +37,7 @@ class InstructorApplicant extends Notification
public function toMail(object $notifiable): MailMessage public function toMail(object $notifiable): MailMessage
{ {
return (new MailMessage) return (new MailMessage)
->subject(get_phrase('Instructor Application Approved') . ' - ' . config('app.name')) ->subject(get_phrase('Instructor Application Submitted') . ' - ' . config('app.name'))
->view('vendor.notifications.instructor_applicant', [ ->view('vendor.notifications.instructor_applicant', [
'user' => $notifiable, 'user' => $notifiable,
'application' => $this->application 'application' => $this->application

View File

@ -428,7 +428,7 @@ img {
} }
.eBtn { .eBtn {
border: none; border: white 2px solid;
padding: 12px 30px; padding: 12px 30px;
border-radius: 10px; border-radius: 10px;
color: #fff; color: #fff;
@ -444,10 +444,12 @@ img {
} }
.eBtn:hover { .eBtn:hover {
border: 1px solid; border: var(--color-1) 2px solid !important;
text-decoration: none;
border-color: var(--color-1);
background-position: right center; background-position: right center;
border-color: var(--color-1); border-color: var(--color-1);
transform: translateY(-2px); transform: translateY(-1px);
color: #333 !important; color: #333 !important;
box-shadow: 0 6px 20px rgba(2, 25, 110, 0.25); box-shadow: 0 6px 20px rgba(2, 25, 110, 0.25);
} }

View File

@ -88,7 +88,13 @@
<div class="application-details"> <div class="application-details">
<p><strong>{{ get_phrase('Application Details') }}:</strong></p> <p><strong>{{ get_phrase('Application Details') }}:</strong></p>
<p><strong>{{ get_phrase('Application ID') }}:</strong> {{ $application->id }}</p> <p><strong>{{ get_phrase('Application ID') }}:</strong> {{ $application->id }}</p>
<p><strong>{{ get_phrase('Submission Date') }}:</strong> {{ $application->created_at->format('F d, Y') }}</p> <p><strong>{{ get_phrase('Submission Date') }}:</strong>
@if(method_exists($application->created_at, 'format'))
{{ $application->created_at->format('F d, Y') }}
@else
{{ date('F d, Y') }}
@endif
</p>
<p><strong>{{ get_phrase('Current Status') }}:</strong> <p><strong>{{ get_phrase('Current Status') }}:</strong>
<span class="status-pending">{{ get_phrase('Under Review') }}</span> <span class="status-pending">{{ get_phrase('Under Review') }}</span>
</p> </p>