diff --git a/app/Mail/AccountRegister.php b/app/Mail/AccountRegister.php new file mode 100644 index 0000000..b6cfe78 --- /dev/null +++ b/app/Mail/AccountRegister.php @@ -0,0 +1,65 @@ +restaurantuser = $restaurantuser; + $this->restaurantName = $restaurantName; + } + + /** + * Build the message. + * + * @return $this + */ + + + public function build() + { + return $this->view('Admin.pages.mail.account_register'); + } + + /** + * Get the message envelope. + * + * @return \Illuminate\Mail\Mailables\Envelope + */ + public function envelope(): Envelope + { + return new Envelope( + subject: 'New Account Registration Details', + ); + } + + /** + * Get the attachments for the message. + * + * @return array + */ + public function attachments(): array + { + return []; + } +} + diff --git a/app/Services/APIs/RestaurantService/RestAuthApiService.php b/app/Services/APIs/RestaurantService/RestAuthApiService.php index f1a2400..d5fbc2b 100644 --- a/app/Services/APIs/RestaurantService/RestAuthApiService.php +++ b/app/Services/APIs/RestaurantService/RestAuthApiService.php @@ -2,6 +2,7 @@ namespace App\Services\APIs\RestaurantService; +use App\Mail\AccountRegister; use App\Models\ManageRestaurant; use App\Models\ManageVoucherModel; use Exception; @@ -80,9 +81,9 @@ class RestAuthApiService DB::commit(); - // $token = auth()->login($restaurantuser); + Mail::to('sayliraut@yopmail.com')->send(new \App\Mail\AccountRegister($restaurantuser, $selectedRestaurant->name)); - // Return response with user details, access token, and status + // Prepare the response data $response = [ 'user' => $restaurantuser, // 'restaurant_details' => $restaurantId, @@ -94,12 +95,13 @@ class RestAuthApiService } catch (QueryException $e) { // Rollback transaction in case of an error DB::rollBack(); - Log::error('Restaurant Registration Failed ' . $e->getMessage()); + Log::error('Restaurant Registration Failed: ' . $e->getMessage()); return jsonResponseWithErrorMessageApi(__('auth.authentication_failed'), 403); } } + public function login($request) { try { diff --git a/app/Services/APIs/RestaurantService/RestaurantApi_Service.php b/app/Services/APIs/RestaurantService/RestaurantApi_Service.php index 7ec5f2e..857fde7 100644 --- a/app/Services/APIs/RestaurantService/RestaurantApi_Service.php +++ b/app/Services/APIs/RestaurantService/RestaurantApi_Service.php @@ -109,6 +109,11 @@ class RestaurantApi_Service DB::rollBack(); return jsonResponseWithErrorMessageApi(__('error_message.restaurant_data_not_found'), 404); } + if ($request->has('image')) { + $image = $request->image; + $tnormalImage = saveSingleImageWithoutCrop($image, 'restaurant_images', null); + $restaurant->update(['image' => $tnormalImage]); + } $restaurant->update([ 'name' => $request['name'], @@ -120,6 +125,7 @@ class RestaurantApi_Service 'try_on_3' => $request['try_on_3'], 'try_on_4' => $request['try_on_4'], + ]); $restaurant->description = strip_tags($restaurant->description); diff --git a/resources/views/Admin/pages/mail/account_register.blade.php b/resources/views/Admin/pages/mail/account_register.blade.php new file mode 100644 index 0000000..e235ec3 --- /dev/null +++ b/resources/views/Admin/pages/mail/account_register.blade.php @@ -0,0 +1,55 @@ + + + + + + New Account Registration + + + + +
+

New Account Registration

+

A new user has registered for the restaurant "{{ $restaurantName }}". Below are the details of the new user: +

+

First Name: {{ $restaurantuser->first_name }}

+

Last Name: {{ $restaurantuser->last_name }}

+

Email Address: {{ $restaurantuser->email_address }}

+

Phone Number: {{ $restaurantuser->phone_number }}

+

Date of Birth: {{ $restaurantuser->date_of_birth }}

+

Thank you

+
+ + + diff --git a/resources/views/Admin/pages/mail/rest_user_approval.blade.php b/resources/views/Admin/pages/mail/rest_user_approval.blade.php index 4b4a2e8..ddb0b62 100644 --- a/resources/views/Admin/pages/mail/rest_user_approval.blade.php +++ b/resources/views/Admin/pages/mail/rest_user_approval.blade.php @@ -8,11 +8,12 @@

User Request Approval

Hello {{ $content['first_name'] }} {{ $content['last_name'] }}

-

Your request has been approved. Here are the details:

+

Your request to join Cheers to the Season Restaurant App has been approved. Below are the details:

Thank you!