original_details)) { // Check date change if (!empty($this->original_details['old_date']) && $this->original_details['old_date'] != $this->booking->date) { $old_date_formatted = evavel_date_createFromFormatTranslate('Y-m-d', $this->original_details['old_date'], $this->booking->language, 'l j F Y'); $new_date_formatted = evavel_date_createFromFormatTranslate('Y-m-d', $this->booking->date, $this->booking->language, 'l j F Y'); $modifications['date'] = [ 'old' => $this->original_details['old_date'], 'old_formatted' => $old_date_formatted, 'new' => $this->booking->date, 'new_formatted' => $new_date_formatted ]; } // Check time change if (!empty($this->original_details['old_time']) && $this->original_details['old_time'] != $this->booking->time) { $old_time_formatted = evavel_seconds_to_Hm($this->original_details['old_time']); $new_time_formatted = evavel_seconds_to_Hm($this->booking->time); $modifications['time'] = [ 'old' => $this->original_details['old_time'], 'old_formatted' => $old_time_formatted, 'new' => $this->booking->time, 'new_formatted' => $new_time_formatted ]; } // Check party size change if (!empty($this->original_details['old_party']) && $this->original_details['old_party'] != $this->booking->party) { $modifications['guests'] = [ 'old' => $this->original_details['old_party'], 'new' => $this->booking->party ]; } } $data['data'] = [ 'icon' => 'success', 'booking_id' => $this->booking->id, 'status' => $this->booking->status, 'status_label' => BookingStatus::label($this->booking->status), 'title' => $this->title(), 'text' => $this->text($user), 'link' => $this->link($user), 'modification' => $modifications // Add the structured modification data ]; $notification = \Alexr\Models\Notification::create($data); $notification->save(); } protected function title() { return __eva('MODIFIED BOOKING'); } protected function link($user) { return [ 'name' => 'bookings-list-date', 'params' => ['tenantId' => $this->booking->restaurant_id, 'yearmonthday' => $this->booking->date] ]; } }