gitDone
This commit is contained in:
@@ -29,83 +29,60 @@ class ReinstateRestaurant extends Command
|
||||
/**
|
||||
* Execute the console command.
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
try {
|
||||
$recordsToUpdate = RedeemRestaurant::where('is_redeem', 1)->get();
|
||||
|
||||
foreach ($recordsToUpdate as $record) {
|
||||
// Find restaurant
|
||||
$managerestaurant = ManageRestaurant::where('id', $record->manage_restaurants_xid)->first();
|
||||
public function handle()
|
||||
{
|
||||
try {
|
||||
$recordsToUpdate = RedeemRestaurant::where('is_redeem', 1)->get();
|
||||
|
||||
// Fetch customer
|
||||
$customerData = IamPrincipal::where('id', $record->iam_principal_xid)
|
||||
->where('notification_status', 1)
|
||||
->where('principal_type_xid', 3)
|
||||
->first();
|
||||
foreach ($recordsToUpdate as $record) {
|
||||
//find restaurant
|
||||
$managerestaurant = ManageRestaurant::where('id', $record->manage_restaurants_xid)->first();
|
||||
|
||||
if ($managerestaurant && $managerestaurant->is_active == 1) {
|
||||
$redeemDate = Carbon::parse($record->redeem_date);
|
||||
$fourHourPlusTimeOfRecord = $redeemDate->copy()->addHours(4);
|
||||
$currentTime = Carbon::now();
|
||||
$customerData = IamPrincipal::where('id', $record->iam_principal_xid)->where('notification_status', 1)->where('principal_type_xid',3)->first(); //fetch customer
|
||||
|
||||
if ($currentTime > $fourHourPlusTimeOfRecord) {
|
||||
// Update record
|
||||
$record->update([
|
||||
'is_redeem' => 0,
|
||||
'redeem_date' => null,
|
||||
'count' => $record->count + 1,
|
||||
'is_redeemption_undone' => 0,
|
||||
'redeemption_undone_date' => null,
|
||||
]);
|
||||
if ($managerestaurant && $managerestaurant->is_active == 1) {
|
||||
$redeemDate = Carbon::parse($record->redeem_date);
|
||||
|
||||
// Prepare notification details
|
||||
$restImage = ListingImageUrl('restaurant_images', $managerestaurant->image);
|
||||
$title = "Your " . $managerestaurant->name . " Reinstate successfully";
|
||||
$message = "Your " . $managerestaurant->name . " Reinstate successfully";
|
||||
$content_type = 'Restaurant_Reinstate';
|
||||
$imageUrl = $restImage;
|
||||
$fourHourPlusTimeOfRecord = $redeemDate->copy()->addHours(4);
|
||||
|
||||
// Send notification
|
||||
$notificationSent = onesignalhelper::sendNotificationApi(
|
||||
$customerData->one_signal_player_id,
|
||||
$title,
|
||||
$message,
|
||||
$content_type,
|
||||
$imageUrl,
|
||||
$id = null
|
||||
);
|
||||
$currentTime = Carbon::now();
|
||||
|
||||
// Check if notification was sent successfully
|
||||
if ($notificationSent) {
|
||||
Log::info('Notification sent successfully to customer ID: ' . $customerData->id);
|
||||
if ($currentTime > $fourHourPlusTimeOfRecord) {
|
||||
$record->update([
|
||||
'is_redeem' => 0,
|
||||
'redeem_date' => null,
|
||||
'count' => $record->count + 1,
|
||||
'is_redeemption_undone' => 0,
|
||||
'redeemption_undone_date' => null,
|
||||
]);
|
||||
$restImage = ListingImageUrl('restaurant_images', $managerestaurant->image);
|
||||
$title = "Your " . $managerestaurant->name . " Reinstate successfully";
|
||||
$message = "Your " . $managerestaurant->name . " Reinstate successfully";
|
||||
$content_type = 'Restaurant Reinstate';
|
||||
$imageUrl = $restImage;
|
||||
|
||||
// Store notification details
|
||||
$notificationStored = onesignalhelper::StoreNotificationDetails(
|
||||
$customerData->id,
|
||||
$content_type,
|
||||
$title,
|
||||
$restImage
|
||||
);
|
||||
onesignalhelper::sendNotificationApi(
|
||||
$customerData->one_signal_player_id,
|
||||
$title,
|
||||
$message,
|
||||
$content_type,
|
||||
$imageUrl,
|
||||
$id = null
|
||||
);
|
||||
Log::info('Reinstate of record done at ' . now());
|
||||
|
||||
if ($notificationStored) {
|
||||
Log::info('Notification details stored successfully for customer ID: ' . $customerData->id);
|
||||
} else {
|
||||
Log::warning('Failed to store notification details for customer ID: ' . $customerData->id);
|
||||
}
|
||||
} else {
|
||||
Log::warning('Failed to send notification to customer ID: ' . $customerData->id);
|
||||
}
|
||||
onesignalhelper::StoreNotificationDetails($customerData->id, $content_type, $title, $restImage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Log::info('Reinstate of record done at ' . now());
|
||||
}
|
||||
}
|
||||
}
|
||||
Log::info('Reinstate task ran successfully at ' . now());
|
||||
} catch (\Exception $e) {
|
||||
Log::error('Reinstate function failed: ' . $e->getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Log::info('Reinstate task ran successfully at ' . now());
|
||||
} catch (\Exception $e) {
|
||||
Log::error('Reinstate function failed: ' . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ class ManageRestrauntController extends Controller
|
||||
$allCustomerOneSignalIds = IamPrincipal::select('id', 'one_signal_player_id')->where('is_active', 1)->where('notification_status', 1)->where('principal_type_xid', 3)->get();
|
||||
$title = "New " . $restaurant->name . " is added";
|
||||
$message = "New Restaurant is Now Live.";
|
||||
$content_type = 'New_Restaurant_Added';
|
||||
$content_type = 'New Restaurant Added';
|
||||
$imageUrl = $imagePath;
|
||||
|
||||
foreach ($allCustomerOneSignalIds as $customerIdItem) {
|
||||
|
||||
@@ -26,7 +26,8 @@ class onesignalhelper
|
||||
'id' => $id,
|
||||
],
|
||||
'big_picture' => $imageUrl,
|
||||
// 'app_id' => env('ONE_SIGNAL_APP_ID'),
|
||||
|
||||
'external_id' => [$playerId]
|
||||
// 'authorization' => env('ONE_SIGNAL_AUTHORIZE')
|
||||
];
|
||||
|
||||
|
||||
@@ -70,10 +70,9 @@ $(document).on("click", "#forgot_password_btn", function (e) {
|
||||
if (response.status_code == 200) {
|
||||
form.reset();
|
||||
toastr.success('Otp send it your mail id please check');
|
||||
setTimeout(function () {
|
||||
// toastr.info('Please check your email to reset your password. The link is valid for 5 minutes.');
|
||||
setTimeout(function() {
|
||||
window.location.href = base_url + "/otp";
|
||||
}, 1000);
|
||||
}, 2000);
|
||||
}else if (response.status == 404) {
|
||||
toastr.error('This email id is not exits');
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
{{-- @include('admin.layouts.messages') --}}
|
||||
<h3 class="text-start font-weight-bold mb-3 text-white">WELCOME BACK</h3>
|
||||
<form id="admin_login_form">
|
||||
@csrf
|
||||
@csrf
|
||||
<div class="col-md-12">
|
||||
<div class="mb-3 input-parent">
|
||||
<i class="fa fa-envelope" aria-hidden="true"></i>
|
||||
@@ -97,7 +97,9 @@
|
||||
|
||||
if (response.status_code == 200) {
|
||||
toastr.success(response.message);
|
||||
window.location.href = base_url + "/dashboard";
|
||||
setTimeout(function() {
|
||||
window.location.href = base_url + "/dashboard";
|
||||
}, 2000);
|
||||
} else if (response.status_code == 401) {
|
||||
toastr.error(response.message);
|
||||
form.reset();
|
||||
|
||||
Reference in New Issue
Block a user