@csrf
controller use Illuminate\Http\Request; use Illuminate\Support\Facades\Session; use Illuminate\Support\Facades\Storage; class ProfileController extends Controller { public function update(Request $request) { // Validate the form inputs here... // Store the uploaded image in the temporary folder if ($request->hasFile('profile_image')) { $tempImagePath = $request->file('profile_image')->store('temp', 'public'); // Save the temporary image path in the session to use later Session::put('temp_image_path', $tempImagePath); } // Other profile update logic here... // Notify the head or admin for permission (you can use email or notifications) // Example: sendEmailToHeadForPermission(); return redirect()->route('profile.waiting_for_approval'); } public function waitingForApproval() { // Show a waiting for approval page return view('waiting_for_approval'); } // This route will be accessed by the head or admin to grant permission public function grantPermission() { // Check if the user has the required permission (implement your own logic here) // Move the image from the temporary folder to the final profile picture location $tempImagePath = Session::get('temp_image_path'); if ($tempImagePath) { $finalImagePath = 'frontend/emplphotos/'.$emp_idd.'.jpeg'; Storage::disk('public')->move($tempImagePath, $finalImagePath); } // Update the profile information (you can add your own logic here) // Clear the session variable storing the temporary image path Session::forget('temp_image_path'); // Redirect to the profile update success page return view('profile_update_success'); } } response

Your profile update is pending approval from the head.

Your profile has been updated successfully!