This commit is contained in:
sayliraut
2024-08-05 18:42:46 +05:30
parent 8aaa3e221c
commit 8fbb3d76c6
5 changed files with 134 additions and 5 deletions

View File

@@ -0,0 +1,65 @@
<?php
namespace App\Mail;
use App\Models\IamPrincipal;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Queue\SerializesModels;
class AccountRegister extends Mailable
{
use Queueable, SerializesModels;
public $restaurantuser;
public $restaurantName;
/**
* Create a new message instance.
*
* @param IamPrincipal $restaurantuser
* @param string $restaurantName
* @return void
*/
public function __construct(IamPrincipal $restaurantuser, $restaurantName)
{
$this->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<int, \Illuminate\Mail\Mailables\Attachment>
*/
public function attachments(): array
{
return [];
}
}

View File

@@ -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 {

View File

@@ -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);

View File

@@ -0,0 +1,55 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>New Account Registration</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 20px;
padding: 0;
background-color: #f4f4f4;
}
.container {
max-width: 600px;
margin: auto;
background: #fff;
padding: 20px;
border-radius: 5px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
h1 {
color: #333;
}
p {
font-size: 16px;
color: #555;
margin: 10px 0;
}
.highlight {
font-weight: bold;
color: #333;
}
</style>
</head>
<body>
<div class="container">
<h1>New Account Registration</h1>
<p>A new user has registered for the restaurant "{{ $restaurantName }}". Below are the details of the new user:
</p>
<p><span class="highlight">First Name:</span> {{ $restaurantuser->first_name }}</p>
<p><span class="highlight">Last Name:</span> {{ $restaurantuser->last_name }}</p>
<p><span class="highlight">Email Address:</span> {{ $restaurantuser->email_address }}</p>
<p><span class="highlight">Phone Number:</span> {{ $restaurantuser->phone_number }}</p>
<p><span class="highlight">Date of Birth:</span> {{ $restaurantuser->date_of_birth }}</p>
<p>Thank you</p>
</div>
</body>
</html>

View File

@@ -8,11 +8,12 @@
<body>
<h2>User Request Approval</h2>
<p>Hello {{ $content['first_name'] }}&nbsp;{{ $content['last_name'] }}</p>
<p>Your request has been approved. Here are the details:</p>
<p>Your request to join Cheers to the Season Restaurant App has been approved. Below are the details:</p>
<ul>
<li>Name: {{ $content['first_name'] }}&nbsp;{{ $content['last_name'] }}</li>
<li>Email: {{ $content['email'] }}</li>
<li>Your Password will be <b>{{$content['password']}}</b></li>
<li>Your Password is <b>{{$content['password']}}</b></li>
<li>If you would like to reset your password, login to the app using your automatically generated password, and then reset your password under “Profile”.</li>
<!-- Add more details as needed -->
</ul>
<p>Thank you!</p>