PluginProbe
Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder / 6.2.7
Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder v6.2.7
6.2.14 6.2.13 6.2.12 6.2.10 6.2.11 6.2.9 6.2.8 6.2.7 6.2.6 6.2.5 6.2.4 6.2.3 6.2.2 3.6.22 3.6.31 3.6.40 3.6.41 3.6.42 3.6.50 3.6.51 3.6.60 3.6.61 3.6.62 3.6.64 3.6.65 All 196 releases
fluentform / app / Models / Subscription.php

Subscription.php in Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder 6.2.7, at app/Models/Subscription.php

69 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace FluentForm\App\Models;
4
5 class Subscription extends Model
6 {
7 /**
8 * The table associated with the model.
9 *
10 * @var string
11 */
12 protected $table = 'fluentform_subscriptions';
13
14 /**
15 * A subscription belongs to a form.
16 *
17 * @return \FluentForm\Framework\Database\Orm\Relations\BelongsTo
18 */
19 public function form()
20 {
21 return $this->belongsTo(Form::class, 'form_id', 'id');
22 }
23
24 /**
25 * A subscription belongs to a submission.
26 *
27 * @return \FluentForm\Framework\Database\Orm\Relations\BelongsTo
28 */
29 public function submission()
30 {
31 return $this->belongsTo(Submission::class, 'submission_id', 'id');
32 }
33
34 /**
35 * A subscription has many transactions.
36 *
37 * @return \FluentForm\Framework\Database\Orm\Relations\HasMany
38 */
39 public function transactions()
40 {
41 return $this->hasMany(Transaction::class, 'subscription_id', 'id');
42 }
43
44 public function getOriginalPlanAttribute($value)
45 {
46 return maybe_unserialize($value);
47 }
48
49 public function getVendorResponseAttribute($value)
50 {
51 return maybe_unserialize($value);
52 }
53
54 public function scopeBySubmission($query, $submissionId)
55 {
56 return $query->where('submission_id', $submissionId);
57 }
58
59 public function scopeByVendorSubscriptionId($query, $vendorId)
60 {
61 return $query->where('vendor_subscription_id', $vendorId);
62 }
63
64 public function scopeActive($query)
65 {
66 return $query->where('status', 'active');
67 }
68 }
69