PluginProbe
Fluent Booking – The Ultimate Appointments Scheduling, Events Booking, Events Calendar Solution / trunk
Fluent Booking – The Ultimate Appointments Scheduling, Events Booking, Events Calendar Solution vtrunk
2.4.0 2.3.0 2.2.5 2.2.0 2.1.2 2.1.1 trunk 1.10.0 1.10.01 1.10.02 1.5.0 1.5.01 1.5.02 1.5.1 1.5.10 1.5.20 1.5.21 1.5.22 1.5.23 1.5.24 1.5.25 1.6.0 1.7.0 1.7.1 1.7.2 All 33 releases
fluent-booking / app / Services / Integrations / GlobalNotificationService.php

GlobalNotificationService.php in Fluent Booking – The Ultimate Appointments Scheduling, Events Booking, Events Calendar Solution trunk, at app/Services/Integrations/GlobalNotificationService.php

70 lines 1.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace FluentBooking\App\Services\Integrations;
4
5 use FluentBooking\App\Models\Meta;
6 use FluentBooking\Framework\Support\Arr;
7 use FluentBooking\App\Services\ConditionAssesor;
8
9 class GlobalNotificationService
10 {
11 public function checkCondition($parsedValue, $booking)
12 {
13 return true;
14
15 $conditionSettings = Arr::get($parsedValue, 'conditionals');
16 if (
17 !$conditionSettings ||
18 !Arr::isTrue($conditionSettings, 'status') ||
19 !count(Arr::get($conditionSettings, 'conditions'))
20 ) {
21 return true;
22 }
23
24 return ConditionAssesor::evaluate($parsedValue, $booking);
25 }
26
27 public function getEntry($id, $form)
28 {
29 // $submission = Submission::find($id);
30 // $formInputs = FormFieldsParser::getEntryInputs($form, ['admin_label', 'raw']);
31 // return bookingParser::parseFormEntry($submission, $form, $formInputs);
32 }
33
34 /**
35 * @param $feeds
36 * @param $booking
37 * @param $insertId
38 *
39 * @return array
40 */
41 public function getEnabledFeeds($feeds, $booking)
42 {
43 $enabledFeeds = [];
44 foreach ($feeds as $feed) {
45 $parsedValue = $feed->value;
46 if (!$parsedValue || !Arr::isTrue($parsedValue, 'enabled')) {
47 continue;
48 }
49
50 // Now check if conditions matched or not
51 $isConditionMatched = $this->checkCondition($parsedValue, $booking);
52 if ($isConditionMatched) {
53 $item = [
54 'id' => $feed->id,
55 'key' => $feed->key,
56 'settings' => $parsedValue,
57 ];
58 $enabledFeeds[] = $item;
59 }
60 }
61
62 return $enabledFeeds;
63 }
64
65 public function getNotificationFeeds($slotId, $feedMetaKeys)
66 {
67 return Meta::where('object_id', $slotId)->whereIn('key', $feedMetaKeys)->orderBy('id', 'ASC')->get();
68 }
69 }
70