1 | <?php |
||
14 | class ShopHistory extends ChocolateyModel |
||
15 | { |
||
16 | use Eloquence, Mappable; |
||
17 | |||
18 | /** |
||
19 | * The table associated with the model. |
||
20 | * |
||
21 | * @var string |
||
22 | */ |
||
23 | protected $table = 'chocolatey_shop_history'; |
||
24 | |||
25 | /** |
||
26 | * Primary Key of the Table. |
||
27 | * |
||
28 | * @var string |
||
29 | */ |
||
30 | protected $primaryKey = 'id'; |
||
31 | |||
32 | /** |
||
33 | * The attributes that will be mapped. |
||
34 | * |
||
35 | * @var array |
||
36 | */ |
||
37 | protected $maps = ['transactionSystemName' => 'payment_method', 'transactionId' => 'id']; |
||
38 | |||
39 | /** |
||
40 | * The Appender(s) of the Model. |
||
41 | * |
||
42 | * @var array |
||
43 | */ |
||
44 | protected $appends = ['creationTime', 'transactionSystemName', 'credits', 'price', 'transactionId', 'product']; |
||
45 | |||
46 | /** |
||
47 | * The attributes excluded from the model's JSON form. |
||
48 | * |
||
49 | * @var array |
||
50 | */ |
||
51 | protected $hidden = ['created_at', 'updated_at', 'approved_by', 'user_id', 'item_id']; |
||
52 | |||
53 | /** |
||
54 | * Get Creation Time Attribute. |
||
55 | * |
||
56 | * @return string |
||
57 | */ |
||
58 | public function getCreationTimeAttribute(): string |
||
63 | |||
64 | /** |
||
65 | * Get Payment Method Name. |
||
66 | * |
||
67 | * @return string |
||
68 | */ |
||
69 | public function getTransactionSystemNameAttribute(): string |
||
73 | |||
74 | /** |
||
75 | * Get Transaction Id. |
||
76 | * |
||
77 | * @return int |
||
78 | */ |
||
79 | public function getTransactionIdAttribute(): int |
||
83 | |||
84 | /** |
||
85 | * Get Amount of Given Credits. |
||
86 | * |
||
87 | * @return int |
||
88 | */ |
||
89 | public function getCreditsAttribute(): int |
||
93 | |||
94 | /** |
||
95 | * Get Product Attribute. |
||
96 | * |
||
97 | * @return mixed|object|array |
||
98 | */ |
||
99 | public function getProductAttribute() |
||
103 | |||
104 | /** |
||
105 | * Get Price Attribute. |
||
106 | * |
||
107 | * @return string |
||
108 | */ |
||
109 | public function getPriceAttribute(): string |
||
113 | |||
114 | /** |
||
115 | * Store a new Purchase. |
||
116 | * |
||
117 | * @param int $paymentMethod |
||
118 | * @param int $userId |
||
119 | * @param int $itemId |
||
120 | * |
||
121 | * @return ShopHistory |
||
122 | */ |
||
123 | public function store(int $paymentMethod, int $userId, int $itemId): ShopHistory |
||
133 | } |
||
134 |