diff --git a/app/Http/Controllers/APIs/Customer_API/RulesControllerAPI.php b/app/Http/Controllers/APIs/Customer_API/RulesControllerAPI.php index 53cd3bf..f23f1f8 100644 --- a/app/Http/Controllers/APIs/Customer_API/RulesControllerAPI.php +++ b/app/Http/Controllers/APIs/Customer_API/RulesControllerAPI.php @@ -38,4 +38,27 @@ class RulesControllerAPI extends Controller return jsonResponseWithErrorMessageApi(__('auth.something_went_wrong'), 500); } } + + /** + * Created By : sayli Raut + * Created at : 22 Jully 2024 + * Use : To get referral rules and regulation. + */ + + public function getReferralRules() + { + try { + $token = readHeaderToken(); + if ($token) { + $customerIamId = $token['sub']; + $response = $this->RulesApiServices->getReferralRules(); + return jsonResponseWithSuccessMessageApi(__('success.data_fetched_successfully'), $response, 200); + } else { + return jsonResponseWithErrorMessageApi(__('auth.user_deleted'), 409); + } + } catch (\Exception $e) { + Log::error('Referral rules get data controller function failed: ' . $e->getMessage()); + return jsonResponseWithErrorMessageApi(__('auth.something_went_wrong'), 500); + } + } } diff --git a/app/Services/APIs/CustomerAPIs/RulesApiServices.php b/app/Services/APIs/CustomerAPIs/RulesApiServices.php index a6c35e5..3724bbd 100644 --- a/app/Services/APIs/CustomerAPIs/RulesApiServices.php +++ b/app/Services/APIs/CustomerAPIs/RulesApiServices.php @@ -2,6 +2,7 @@ namespace App\Services\APIs\CustomerAPIs; +use App\Models\ManageReferralRule; use App\Models\ManageRule; use Illuminate\Support\Facades\Log; @@ -22,4 +23,19 @@ class RulesApiServices return jsonResponseWithErrorMessageApi(__('auth.something_went_wrong'), 500); } } + + + public function getReferralRules() + { + try { + $data = ManageReferralRule::select('id', 'title', 'message') + ->get() + ->toArray(); + + return $data; + } catch (Exception $ex) { + Log::error('Voucher rules and regulation Get service failed : ' . $ex->getMessage()); + return jsonResponseWithErrorMessageApi(__('auth.something_went_wrong'), 500); + } + } } diff --git a/resources/views/Admin/pages/manage_notification/manage_notifications_add.blade.php b/resources/views/Admin/pages/manage_notification/manage_notifications_add.blade.php index e251dae..ce9b4fd 100644 --- a/resources/views/Admin/pages/manage_notification/manage_notifications_add.blade.php +++ b/resources/views/Admin/pages/manage_notification/manage_notifications_add.blade.php @@ -135,10 +135,12 @@ @endforeach +
+