1 | <?php |
2 | |
3 | namespace App\Http\Models; |
4 | |
5 | use App\Observers\UserInfoObserver; |
6 | use Illuminate\Database\Eloquent\Factories\HasFactory; |
7 | use Illuminate\Database\Eloquent\Attributes\ObservedBy; |
8 | use Illuminate\Notifications\Notifiable; |
9 | |
10 | #[ObservedBy([UserInfoObserver::class])] |
11 | class UserInfo extends Moloquent |
12 | { |
13 | use HasFactory, Notifiable; |
14 | protected $table = 'user_info'; |
15 | |
16 | protected $fillable = [ |
17 | 'first_name', |
18 | 'last_name', |
19 | 'full_name', |
20 | 'email', |
21 | 'email_verified_at', |
22 | 'job_role', |
23 | 'department', |
24 | 'job_title', |
25 | 'company', |
26 | 'phone', |
27 | 'account_creation_date', |
28 | 'linkedin_url', |
29 | 'fly_grammar_default_language', |
30 | 'user_type', |
31 | 'user_id', |
32 | 'typed_words_per_minute', |
33 | 'wage_per_hour', |
34 | 'email_used_for_login', |
35 | 'signin_source', |
36 | 'signup_source', |
37 | 'last_login', |
38 | 'last_login_fly_learning', |
39 | 'status', |
40 | 'status_date', |
41 | 'user_created_at', |
42 | 'user_updated_at', |
43 | 'company_id', |
44 | 'company_name', |
45 | 'avatar', |
46 | 'hubspot_id', |
47 | 'stripe_id', |
48 | 'instancy_id', |
49 | 'group_id', |
50 | 'group_name', |
51 | 'subgroup_id', |
52 | 'subgroup_name', |
53 | 'role_ids', |
54 | 'role_names', |
55 | 'is_invite', |
56 | 'email_domain', |
57 | 'email_domain_count', |
58 | 'is_any_extension_installed', |
59 | 'is_any_extension_uninstalled', |
60 | 'signed_into_flymsg_extension', |
61 | 'which_browser_has_an_extension_been_installed_on', |
62 | 'last_browser_used', |
63 | 'total_time_saved_by_flymsg_by_user', |
64 | 'total_time_saved_summarized_monthly_by_flymsg_by_user', |
65 | 'total_cost_savings_by_flymsg_by_user', |
66 | 'total_cost_savings_summarized_monthly_by_flymsg_by_user', |
67 | 'total___of_characters_typed_by_flymsg_by_user', |
68 | 'total___of_characters_typed_monthly_by_flymsg_by_user', |
69 | 'last_date_user_used_a_flycut', |
70 | 'number_of_categories_created_last_date', |
71 | 'number_of_categories_created_count', |
72 | 'number_of_flycuts_created_last_date', |
73 | 'number_of_flycuts_created_count', |
74 | 'number_of_flyplates_in_flycuts_last_date', |
75 | 'number_of_flyplates_in_flycuts_count', |
76 | 'clicked_help_last_date', |
77 | 'clicked_help_count', |
78 | 'clicked_settings_last_date', |
79 | 'clicked_settings_count', |
80 | 'clicked_download_extension_last_date', |
81 | 'clicked_download_extension_count', |
82 | 'clicked_contact_sales_last_date', |
83 | 'clicked_contact_sales_count', |
84 | 'df_stripe_customer_id', |
85 | 'subscription_owner', |
86 | 'billing_address_line_1', |
87 | 'billing_address_line_2', |
88 | 'billing_city', |
89 | 'billing_state', |
90 | 'billing_zip', |
91 | 'billing_country', |
92 | 'number_of_completed_payments', |
93 | 'number_of_expected_payments', |
94 | 'payment_method', |
95 | 'flymsg_last_product_purchased', |
96 | 'last_total_invoice_amount', |
97 | 'flymsg_total_sales', |
98 | 'coupon_name', |
99 | 'coupon_code', |
100 | 'coupon_type', |
101 | 'duration', |
102 | 'coupon_value__discount_', |
103 | 'coupon_redemption_limits', |
104 | 'productivity_problems', |
105 | 'type_here_how_flymsg_will_help_you___', |
106 | 'flymsg_use_case', |
107 | 'sign_out_reason', |
108 | 'sign_out_text', |
109 | 'subscription_type', |
110 | 'plan_id', |
111 | 'plan_name', |
112 | 'is_chrome_extension_installed', |
113 | 'is_chrome_extension_uninstalled', |
114 | 'flymsg_chrome_extension_installed__date_', |
115 | 'flymsg_chrome_extension_uninstalled__date_', |
116 | 'flymsg_extension_version_for_chrome', |
117 | 'is_edge_extension_installed', |
118 | 'is_edge_extension_uninstalled', |
119 | 'flymsg_edge_extension_installed__date_', |
120 | 'flymsg_edge_extension_uninstalled__date_', |
121 | 'flymsg_extension_version_for_edge', |
122 | 'flymsg_freemium_subscription_status', |
123 | 'freemium_subscription_start_date', |
124 | 'freemium_subscription_status_updated_on', |
125 | 'freemium_subscription_churn_date', |
126 | 'freemium_cancel_subscription_date', |
127 | 'starter_payment_status', |
128 | 'flymsg_starter_subscription_status', |
129 | 'starter_subscription_status_updated_on', |
130 | 'starter_subscription_start_date', |
131 | 'flymsg_starter_subscription_frequency', |
132 | 'starter_subscription_expiration_date', |
133 | 'starter_cancel_subscription_date', |
134 | 'starter_subscription_churn_date', |
135 | 'flymsg_starter_subscription_monthly_recurring_revenue', |
136 | 'flymsg_starter_subscription_annual_recurring_revenue', |
137 | 'growth_payment_status', |
138 | 'flymsg_growth_subscription_status', |
139 | 'growth_subscription_status_updated_on', |
140 | 'growth_subscription_start_date', |
141 | 'flymsg_growth_subscription_frequency', |
142 | 'growth_subscription_expiration_date', |
143 | 'growth_cancel_subscription_date', |
144 | 'growth_subscription_churn_date', |
145 | 'flymsg_growth_subscription_monthly_recurring_revenue', |
146 | 'growth_subscription_annual_recurring_revenue', |
147 | 'professional_payment_status', |
148 | 'professional_subscription_status', |
149 | 'trail_period_start_date', |
150 | 'trail_period_end_date', |
151 | 'trail_period_canceled_date', |
152 | 'professional_subscription_status_updated_on', |
153 | 'professional_subscription_start_date', |
154 | 'professional_subscription_frequency', |
155 | 'professional_subscription_expiration_date', |
156 | 'professional_cancel_subscription_date', |
157 | 'professional_subscription_churn_date', |
158 | 'professional_subscription_monthly_recurring_revenue', |
159 | 'professional_subscription_annual_recurring_revenue', |
160 | 'sales_pro_teams_subscription_status', |
161 | 'sales_pro_teams_subscription_status_updated_on', |
162 | 'sales_pro_teams_subscription_start_date', |
163 | 'sales_pro_teams_subscription_frequency', |
164 | 'sales_pro_teams_subscription_expiration_date', |
165 | 'sales_pro_teams_cancel_subscription_date', |
166 | 'sales_pro_teams_subscription_churn_date', |
167 | 'sales_pro_teams_subscription_plan_type', |
168 | 'sales_pro_teams_user_type', |
169 | 'deleted_at', |
170 | 'created_at', |
171 | 'updated_at', |
172 | 'total___of_times_flycut_used__count_', |
173 | 'total___of_times_flyposts_is_used_summarized_monthly_by_user__count_', |
174 | 'last_date_user_used_flyposts', |
175 | 'total___of_times_flyposts_used__count_', |
176 | 'total___of_times_flyengage_is_used_summarized_monthly_by_user', |
177 | 'last_date_user_used_flyengage', |
178 | 'total___of_times_flyengage_used__count_', |
179 | |
180 | 'total___of_times_sentence_rewrite_is_used_summarized_monthly_by_user', |
181 | 'last_date_user_used_sentence_rewrite', |
182 | 'total___of_times_sentence_rewrite_used__count_', |
183 | 'total___of_times_paragraph_rewrite_is_used_summarized_monthly_by_user', |
184 | 'last_date_user_used_paragraph_rewrite', |
185 | 'total___of_times_paragraph_rewrite_used__count_', |
186 | |
187 | 'last_date_user_used_flygrammar', |
188 | 'total___of_times_flygrammar_is_used_summarized_monthly_by_user__count_', |
189 | 'total___of_times_flygrammar_used__count_', |
190 | 'total___of_times_flygrammar_accepted_used__count_', |
191 | 'total___of_times_flygrammar_autocorrect_used__count_', |
192 | |
193 | 'total___of_times_flygrammar_is_used_summarized_monthly_by_user', |
194 | 'total___of_times_flygrammar_accepted_is_used_summarized_monthly_by_user', |
195 | 'total___of_times_flygrammar_autocorrect_is_used_summarized_monthly_by_user', |
196 | |
197 | |
198 | 'total_time_saved___january_2022', |
199 | 'total_time_saved___february_2022', |
200 | 'total_time_saved___march_2022', |
201 | 'total_time_saved___april_2022', |
202 | 'total_time_saved___may_2022', |
203 | 'total_time_saved___june_2022', |
204 | 'total_time_saved___july_2022', |
205 | 'total_time_saved___august_2022', |
206 | 'total_time_saved___september_2022', |
207 | 'total_time_saved___october_2022', |
208 | 'total_time_saved___november_2022', |
209 | 'total_time_saved___december_2022', |
210 | 'total_cost_savings___january_2022', |
211 | 'total_cost_savings___february_2022', |
212 | 'total_cost_savings___march_2022', |
213 | 'total_cost_savings___april_2022', |
214 | 'total_cost_savings___may_2022', |
215 | 'total_cost_savings___june_2022', |
216 | 'total_cost_savings___july_2022', |
217 | 'total_cost_savings___august_2022', |
218 | 'total_cost_savings___september_2022', |
219 | 'total_cost_savings___october_2022', |
220 | 'total_cost_savings___november_2022', |
221 | 'total_cost_savings___december_2022', |
222 | 'of_characters_typed___january_2022', |
223 | 'of_characters_typed___february_2022', |
224 | 'of_characters_typed___march_2022', |
225 | 'of_characters_typed___april_2022', |
226 | 'of_characters_typed___may_2022', |
227 | 'of_characters_typed___june_2022', |
228 | 'of_characters_typed___july_2022', |
229 | 'of_characters_typed___august_2022', |
230 | 'of_characters_typed___september_2022', |
231 | 'of_characters_typed___october_2022', |
232 | 'of_characters_typed___november_2022', |
233 | 'of_characters_typed___december_2022', |
234 | |
235 | |
236 | 'total_time_saved___january_2023', |
237 | 'total_time_saved___february_2023', |
238 | 'total_time_saved___march_2023', |
239 | 'total_time_saved___april_2023', |
240 | 'total_time_saved___may_2023', |
241 | 'total_time_saved___june_2023', |
242 | 'total_time_saved___july_2023', |
243 | 'total_time_saved___august_2023', |
244 | 'total_time_saved___september_2023', |
245 | 'total_time_saved___october_2023', |
246 | 'total_time_saved___november_2023', |
247 | 'total_time_saved___december_2023', |
248 | 'total_cost_savings___january_2023', |
249 | 'total_cost_savings___february_2023', |
250 | 'total_cost_savings___march_2023', |
251 | 'total_cost_savings___april_2023', |
252 | 'total_cost_savings___may_2023', |
253 | 'total_cost_savings___june_2023', |
254 | 'total_cost_savings___july_2023', |
255 | 'total_cost_savings___august_2023', |
256 | 'total_cost_savings___september_2023', |
257 | 'total_cost_savings___october_2023', |
258 | 'total_cost_savings___november_2023', |
259 | 'total_cost_savings___december_2023', |
260 | 'of_characters_typed___january_2023', |
261 | 'of_characters_typed___february_2023', |
262 | 'of_characters_typed___march_2023', |
263 | 'of_characters_typed___april_2023', |
264 | 'of_characters_typed___may_2023', |
265 | 'of_characters_typed___june_2023', |
266 | 'of_characters_typed___july_2023', |
267 | 'of_characters_typed___august_2023', |
268 | 'of_characters_typed___september_2023', |
269 | 'of_characters_typed___october_2023', |
270 | 'of_characters_typed___november_2023', |
271 | 'of_characters_typed___december_2023', |
272 | |
273 | |
274 | 'total_time_saved___january_2024', |
275 | 'total_time_saved___february_2024', |
276 | 'total_time_saved___march_2024', |
277 | 'total_time_saved___april_2024', |
278 | 'total_time_saved___may_2024', |
279 | 'total_time_saved___june_2024', |
280 | 'total_time_saved___july_2024', |
281 | 'total_time_saved___august_2024', |
282 | 'total_time_saved___september_2024', |
283 | 'total_time_saved___october_2024', |
284 | 'total_time_saved___november_2024', |
285 | 'total_time_saved___december_2024', |
286 | 'total_cost_savings___january_2024', |
287 | 'total_cost_savings___february_2024', |
288 | 'total_cost_savings___march_2024', |
289 | 'total_cost_savings___april_2024', |
290 | 'total_cost_savings___may_2024', |
291 | 'total_cost_savings___june_2024', |
292 | 'total_cost_savings___july_2024', |
293 | 'total_cost_savings___august_2024', |
294 | 'total_cost_savings___september_2024', |
295 | 'total_cost_savings___october_2024', |
296 | 'total_cost_savings___november_2024', |
297 | 'total_cost_savings___december_2024', |
298 | 'of_characters_typed___january_2024', |
299 | 'of_characters_typed___february_2024', |
300 | 'of_characters_typed___march_2024', |
301 | 'of_characters_typed___april_2024', |
302 | 'of_characters_typed___may_2024', |
303 | 'of_characters_typed___june_2024', |
304 | 'of_characters_typed___july_2024', |
305 | 'of_characters_typed___august_2024', |
306 | 'of_characters_typed___september_2024', |
307 | 'of_characters_typed___october_2024', |
308 | 'of_characters_typed___november_2024', |
309 | 'of_characters_typed___december_2024', |
310 | |
311 | |
312 | 'total_time_saved___january_2025', |
313 | 'total_time_saved___february_2025', |
314 | 'total_time_saved___march_2025', |
315 | 'total_time_saved___april_2025', |
316 | 'total_time_saved___may_2025', |
317 | 'total_time_saved___june_2025', |
318 | 'total_time_saved___july_2025', |
319 | 'total_time_saved___august_2025', |
320 | 'total_time_saved___september_2025', |
321 | 'total_time_saved___october_2025', |
322 | 'total_time_saved___november_2025', |
323 | 'total_time_saved___december_2025', |
324 | 'total_cost_savings___january_2025', |
325 | 'total_cost_savings___february_2025', |
326 | 'total_cost_savings___march_2025', |
327 | 'total_cost_savings___april_2025', |
328 | 'total_cost_savings___may_2025', |
329 | 'total_cost_savings___june_2025', |
330 | 'total_cost_savings___july_2025', |
331 | 'total_cost_savings___august_2025', |
332 | 'total_cost_savings___september_2025', |
333 | 'total_cost_savings___october_2025', |
334 | 'total_cost_savings___november_2025', |
335 | 'total_cost_savings___december_2025', |
336 | 'of_characters_typed___january_2025', |
337 | 'of_characters_typed___february_2025', |
338 | 'of_characters_typed___march_2025', |
339 | 'of_characters_typed___april_2025', |
340 | 'of_characters_typed___may_2025', |
341 | 'of_characters_typed___june_2025', |
342 | 'of_characters_typed___july_2025', |
343 | 'of_characters_typed___august_2025', |
344 | 'of_characters_typed___september_2025', |
345 | 'of_characters_typed___october_2025', |
346 | 'of_characters_typed___november_2025', |
347 | 'of_characters_typed___december_2025', |
348 | 'is_invitation' |
349 | ]; |
350 | |
351 | private function formatFloatValue($value) |
352 | { |
353 | return number_format($value, 10, '.', ''); |
354 | } |
355 | |
356 | public function getTotalTimeSavedByFlymsgByUserAttribute($value) |
357 | { |
358 | return $this->formatFloatValue($value); |
359 | } |
360 | public function getTotalCostSavingsByFlymsgByUserAttribute($value) |
361 | { |
362 | return $this->formatFloatValue($value); |
363 | } |
364 | public function getTotalTimeSaved___January2022Attribute($value) |
365 | { |
366 | return $this->formatFloatValue($value); |
367 | } |
368 | public function getTotalTimeSaved___February2022Attribute($value) |
369 | { |
370 | return $this->formatFloatValue($value); |
371 | } |
372 | public function getTotalTimeSaved___March2022Attribute($value) |
373 | { |
374 | return $this->formatFloatValue($value); |
375 | } |
376 | public function getTotalTimeSaved___April2022Attribute($value) |
377 | { |
378 | return $this->formatFloatValue($value); |
379 | } |
380 | public function getTotalTimeSaved___May2022Attribute($value) |
381 | { |
382 | return $this->formatFloatValue($value); |
383 | } |
384 | public function getTotalTimeSaved___June2022Attribute($value) |
385 | { |
386 | return $this->formatFloatValue($value); |
387 | } |
388 | public function getTotalTimeSaved___July2022Attribute($value) |
389 | { |
390 | return $this->formatFloatValue($value); |
391 | } |
392 | public function getTotalTimeSaved___August2022Attribute($value) |
393 | { |
394 | return $this->formatFloatValue($value); |
395 | } |
396 | public function getTotalTimeSaved___September2022Attribute($value) |
397 | { |
398 | return $this->formatFloatValue($value); |
399 | } |
400 | public function getTotalTimeSaved___October2022Attribute($value) |
401 | { |
402 | return $this->formatFloatValue($value); |
403 | } |
404 | public function getTotalTimeSaved___November2022Attribute($value) |
405 | { |
406 | return $this->formatFloatValue($value); |
407 | } |
408 | public function getTotalTimeSaved___December2022Attribute($value) |
409 | { |
410 | return $this->formatFloatValue($value); |
411 | } |
412 | public function getTotalTimeSaved___January2023Attribute($value) |
413 | { |
414 | return $this->formatFloatValue($value); |
415 | } |
416 | public function getTotalTimeSaved___February2023Attribute($value) |
417 | { |
418 | return $this->formatFloatValue($value); |
419 | } |
420 | public function getTotalTimeSaved___March2023Attribute($value) |
421 | { |
422 | return $this->formatFloatValue($value); |
423 | } |
424 | public function getTotalTimeSaved___April2023Attribute($value) |
425 | { |
426 | return $this->formatFloatValue($value); |
427 | } |
428 | public function getTotalTimeSaved___May2023Attribute($value) |
429 | { |
430 | return $this->formatFloatValue($value); |
431 | } |
432 | public function getTotalTimeSaved___June2023Attribute($value) |
433 | { |
434 | return $this->formatFloatValue($value); |
435 | } |
436 | public function getTotalTimeSaved___July2023Attribute($value) |
437 | { |
438 | return $this->formatFloatValue($value); |
439 | } |
440 | public function getTotalTimeSaved___August2023Attribute($value) |
441 | { |
442 | return $this->formatFloatValue($value); |
443 | } |
444 | public function getTotalTimeSaved___September2023Attribute($value) |
445 | { |
446 | return $this->formatFloatValue($value); |
447 | } |
448 | public function getTotalTimeSaved___October2023Attribute($value) |
449 | { |
450 | return $this->formatFloatValue($value); |
451 | } |
452 | public function getTotalTimeSaved___November2023Attribute($value) |
453 | { |
454 | return $this->formatFloatValue($value); |
455 | } |
456 | public function getTotalTimeSaved___December2023Attribute($value) |
457 | { |
458 | return $this->formatFloatValue($value); |
459 | } |
460 | public function getTotalTimeSaved___January2024Attribute($value) |
461 | { |
462 | return $this->formatFloatValue($value); |
463 | } |
464 | public function getTotalTimeSaved___February2024Attribute($value) |
465 | { |
466 | return $this->formatFloatValue($value); |
467 | } |
468 | public function getTotalTimeSaved___March2024Attribute($value) |
469 | { |
470 | return $this->formatFloatValue($value); |
471 | } |
472 | public function getTotalTimeSaved___April2024Attribute($value) |
473 | { |
474 | return $this->formatFloatValue($value); |
475 | } |
476 | public function getTotalTimeSaved___May2024Attribute($value) |
477 | { |
478 | return $this->formatFloatValue($value); |
479 | } |
480 | public function getTotalTimeSaved___June2024Attribute($value) |
481 | { |
482 | return $this->formatFloatValue($value); |
483 | } |
484 | public function getTotalTimeSaved___July2024Attribute($value) |
485 | { |
486 | return $this->formatFloatValue($value); |
487 | } |
488 | public function getTotalTimeSaved___August2024Attribute($value) |
489 | { |
490 | return $this->formatFloatValue($value); |
491 | } |
492 | public function getTotalTimeSaved___September2024Attribute($value) |
493 | { |
494 | return $this->formatFloatValue($value); |
495 | } |
496 | public function getTotalTimeSaved___October2024Attribute($value) |
497 | { |
498 | return $this->formatFloatValue($value); |
499 | } |
500 | public function getTotalTimeSaved___November2024Attribute($value) |
501 | { |
502 | return $this->formatFloatValue($value); |
503 | } |
504 | public function getTotalTimeSaved___December2024Attribute($value) |
505 | { |
506 | return $this->formatFloatValue($value); |
507 | } |
508 | public function getTotalTimeSaved___January2025Attribute($value) |
509 | { |
510 | return $this->formatFloatValue($value); |
511 | } |
512 | public function getTotalTimeSaved___February2025Attribute($value) |
513 | { |
514 | return $this->formatFloatValue($value); |
515 | } |
516 | public function getTotalTimeSaved___March2025Attribute($value) |
517 | { |
518 | return $this->formatFloatValue($value); |
519 | } |
520 | public function getTotalTimeSaved___April2025Attribute($value) |
521 | { |
522 | return $this->formatFloatValue($value); |
523 | } |
524 | public function getTotalTimeSaved___May2025Attribute($value) |
525 | { |
526 | return $this->formatFloatValue($value); |
527 | } |
528 | public function getTotalTimeSaved___June2025Attribute($value) |
529 | { |
530 | return $this->formatFloatValue($value); |
531 | } |
532 | public function getTotalTimeSaved___July2025Attribute($value) |
533 | { |
534 | return $this->formatFloatValue($value); |
535 | } |
536 | public function getTotalTimeSaved___August2025Attribute($value) |
537 | { |
538 | return $this->formatFloatValue($value); |
539 | } |
540 | public function getTotalTimeSaved___September2025Attribute($value) |
541 | { |
542 | return $this->formatFloatValue($value); |
543 | } |
544 | public function getTotalTimeSaved___October2025Attribute($value) |
545 | { |
546 | return $this->formatFloatValue($value); |
547 | } |
548 | public function getTotalTimeSaved___November2025Attribute($value) |
549 | { |
550 | return $this->formatFloatValue($value); |
551 | } |
552 | public function getTotalTimeSaved___December2025Attribute($value) |
553 | { |
554 | return $this->formatFloatValue($value); |
555 | } |
556 | |
557 | public function setEmailAttribute(string $value): void |
558 | { |
559 | $this->attributes['email'] = strtolower($value); |
560 | } |
561 | |
562 | public function getEmailAttribute(?string $value): ?string |
563 | { |
564 | return $value ? strtolower($value) : null; |
565 | } |
566 | } |