⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.19
Server IP:
178.33.27.10
Server:
Linux cpanel.dev-unit.com 3.10.0-1160.108.1.el7.x86_64 #1 SMP Thu Jan 25 16:17:31 UTC 2024 x86_64
Server Software:
Apache/2.4.57 (Unix) OpenSSL/1.0.2k-fips
PHP Version:
8.2.11
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
home
/
id
/
dalily.dev-unit.com
/
app
/
Observers
/
Traits
/
View File Name :
PaymentTrait.php
<?php /* * LaraClassifier - Classified Ads Web Application * Copyright (c) BeDigit. All Rights Reserved * * Website: https://laraclassifier.com * Author: Mayeul Akpovi (BeDigit - https://bedigit.com) * * LICENSE * ------- * This software is provided under a license agreement and may only be used or copied * in accordance with its terms, including the inclusion of the above copyright notice. * As this software is sold exclusively on CodeCanyon, * please review the full license details here: https://codecanyon.net/licenses/standard */ namespace App\Observers\Traits; use App\Models\Language; use App\Models\Scopes\ActiveScope; use Throwable; trait PaymentTrait { /** * Clear caches related to the promotion payments * * @param $payment * @return void */ private function clearCacheRelatedToPromotionPayment($payment): void { $isPromoting = (str_ends_with($payment->payable_type, 'Post')); if (!$isPromoting) { return; } if (empty($payment->payable)) { return; } try { $post = $payment->payable; cache()->forget($post->country_code . '.sitemaps.posts.xml'); cache()->forget($post->country_code . '.home.getPosts.premium'); cache()->forget($post->country_code . '.home.getPosts.latest'); cache()->forget('post.withoutGlobalScopes.with.city.pictures.' . $post->id); cache()->forget('post.with.city.pictures.' . $post->id); // Need to be caught (Independently) $languages = Language::query()->withoutGlobalScopes([ActiveScope::class])->get(['code']); if ($languages->count() > 0) { foreach ($languages as $language) { cache()->forget('post.withoutGlobalScopes.with.city.pictures.' . $post->id . '.' . $language->code); cache()->forget('post.with.city.pictures.' . $post->id . '.' . $language->code); } } cache()->forget('posts.similar.category.' . $post->category_id . '.post.' . $post->id); cache()->forget('posts.similar.city.' . $post->city_id . '.post.' . $post->id); } catch (Throwable $e) { } } /** * Clear caches related to the subscription payments * * @param $payment * @return void */ private function clearCacheRelatedToSubscriptionPayment($payment): void { //... } }