feat: add bylaw management features including documents, legal authorities, subject categories, and nodes
This commit is contained in:
@@ -3,13 +3,13 @@
|
||||
namespace App\Jobs;
|
||||
|
||||
// These are the classes we need to import for our job to work
|
||||
use App\Models\UserSubscriber;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\InteractsWithQueue; // Your model for tracking user subscriptions
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use App\Models\UserSubscriber; // Your model for tracking user subscriptions
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
@@ -40,8 +40,9 @@ class CheckBazaarSubscription implements ShouldQueue
|
||||
$package_name = 'com.razzaghi.lawbook.android'; // Your app's package name
|
||||
|
||||
// If there's no purchase token, we can't do anything, so we stop.
|
||||
if (!$purchase_token) {
|
||||
Log::info('Job skipped: No purchase token for UserSubscriber ID: ' . $this->userSubscriber->id);
|
||||
if (! $purchase_token) {
|
||||
Log::info('Job skipped: No purchase token for UserSubscriber ID: '.$this->userSubscriber->id);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -69,16 +70,16 @@ class CheckBazaarSubscription implements ShouldQueue
|
||||
// If the expiration date in our database is different, update it
|
||||
if ($this->userSubscriber->expired_at->notEqualTo($bazaarExpiredAt)) {
|
||||
$this->userSubscriber->update(['expired_at' => $bazaarExpiredAt]);
|
||||
Log::info('Subscription date updated for user: ' . $this->userSubscriber->user_id);
|
||||
Log::info('Subscription date updated for user: '.$this->userSubscriber->user_id);
|
||||
}
|
||||
} else {
|
||||
// If the subscription is no longer valid, update it in our database to expire now
|
||||
$this->userSubscriber->update(['expired_at' => now()]);
|
||||
Log::warning('Subscription found expired on Bazaar for user: ' . $this->userSubscriber->user_id);
|
||||
Log::warning('Subscription found expired on Bazaar for user: '.$this->userSubscriber->user_id);
|
||||
}
|
||||
} else {
|
||||
// If the API call failed, log the error for debugging
|
||||
Log::error('Failed to fetch subscription from Bazaar', ['status' => $response->status(), 'body' => $response->body()]);
|
||||
// If the API call failed, log the error for debugging
|
||||
Log::error('Failed to fetch subscription from Bazaar', ['status' => $response->status(), 'body' => $response->body()]);
|
||||
}
|
||||
|
||||
} catch (\Exception $e) {
|
||||
@@ -86,4 +87,4 @@ class CheckBazaarSubscription implements ShouldQueue
|
||||
Log::error('Exception while checking Bazaar subscription', ['error' => $e->getMessage()]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user