PluginProbe
SureCart – Ecommerce Made Easy For Selling Physical Products, Digital Downloads, Subscriptions, Donations, & Payments / 4.6.6
SureCart – Ecommerce Made Easy For Selling Physical Products, Digital Downloads, Subscriptions, Donations, & Payments v4.6.6
4.7.2 4.7.1 4.7.0 4.6.6 4.6.5 4.6.4 4.6.3 4.6.2 4.6.1 4.6.0 4.5.1 4.5.0 4.4.2 4.4.1 4.4.0 4.3.3 4.3.2 4.3.1 4.3.0 4.2.3 4.2.2 4.2.1 1.0.3 1.0.4 1.0.5 All 281 releases
surecart / app / src / Models / AbandonedCheckout.php
AbandonedCheckout.php
70 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace SureCart\Models;
4
5 use SureCart\Models\Traits\HasCheckout;
6 use SureCart\Models\Traits\HasCustomer;
7 use SureCart\Models\Traits\HasDates;
8 use SureCart\Models\Traits\HasPromotion;
9 use SureCart\Support\TimeDate;
10
11 /**
12 * Order model
13 */
14 class AbandonedCheckout extends Model {
15 use HasCustomer;
16 use HasCheckout;
17 use HasDates;
18 use HasPromotion;
19
20 /**
21 * Rest API endpoint
22 *
23 * @var string
24 */
25 protected $endpoint = 'abandoned_checkouts';
26
27 /**
28 * Object name
29 *
30 * @var string
31 */
32 protected $object_name = 'abandoned_checkout';
33
34 /**
35 * Set the latest checkout session attribute
36 *
37 * @param array $value Checkout session properties.
38 * @return void
39 */
40 protected function setLatestRecoverableCheckoutAttribute( $value ) {
41 $this->setRelation( 'recovered_checkout', $value, Checkout::class );
42 }
43
44 /**
45 * Get stats for the order.
46 *
47 * @param array $args Array of arguments for the statistics.
48 *
49 * @return \SureCart\Models\Statistic;
50 */
51 protected function stats( $args = [] ) {
52 $stat = new Statistic();
53 return $stat->where( $args )->find( 'abandoned_checkouts' );
54 }
55
56 /**
57 * Get the notifications scheduled at date and time attribute.
58 *
59 * @return string
60 */
61 public function getNotificationsScheduledAtDateTimeAttribute() {
62 return array_map(
63 function ( $scheduled_at ) {
64 return TimeDate::formatDateAndTime( $scheduled_at );
65 },
66 $this->notifications_scheduled_at ?? []
67 );
68 }
69 }
70