Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
4 / 4
CRAP
100.00% covered (success)
100.00%
1 / 1
Plans
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
4 / 4
4
100.00% covered (success)
100.00%
1 / 1
 getCurrencyAttribute
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getIntervalAttribute
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getUnitAmountAttribute
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 newFactory
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3namespace App\Http\Models;
4
5use Database\Factories\Http\Models\PlansFactory;
6use Illuminate\Database\Eloquent\Factories\HasFactory;
7
8class Plans extends Moloquent
9{
10    use HasFactory;
11
12    const FREEMIUM_IDENTIFIER = 'freemium';
13
14    const STARTER_MONTHLY_IDENTIFIER = 'starter';
15    const GROWTH_MONTHLY_IDENTIFIER = 'growth';
16    const PROFESSIONAL_MONTHLY_IDENTIFIER = 'sales-pro-monthly';
17
18    const STARTER_YEARLY_IDENTIFIER = 'starter-yearly';
19    const GROWTH_YEARLY_IDENTIFIER = 'growth-yearly';
20    const PROFESSIONAL_YEARLY_IDENTIFIER = 'sales-pro-yearly';
21
22    const APPSUMO_IDENTIFIER = 'appsumo-growth-lifetime';
23    const DEALFUEL_IDENTIFIER = 'dealfuel-growth-lifetime';
24
25    const ProPlanTeamsSMB = "pro-plan-teams-smb";
26    const ProPlanTeamsENT = "pro-plan-teams-ent";
27
28
29    protected $table = 'plans';
30
31    protected $fillable = [
32        'title',
33        'identifier',
34        'stripe_id',
35        'stripe_obj',
36        'features',
37        'hubspot_name',
38        'has_fly_learning',
39        'user_custom_prompts',
40        'user_persona_available',
41        'can_disable_flygrammar',
42        'flycut_deployment',
43        'flygrammar_actions',
44        'prompts_per_day',
45        'regenerate_count',
46        'flycuts_features',
47    ];
48
49    protected $casts = [
50        'stripe_obj' => 'array',
51        'features' => 'array',
52    ];
53
54    protected $hidden = ['stripe_obj'];
55
56    protected $appends = ['currency', 'interval', 'unit_amount'];
57
58    public function getCurrencyAttribute()
59    {
60        return $this->stripe_obj['currency'] ?? '';
61    }
62
63    public function getIntervalAttribute()
64    {
65        return $this->stripe_obj['recurring']['interval'] ?? '';
66    }
67
68    public function getUnitAmountAttribute()
69    {
70        return $this->stripe_obj['unit_amount'] ?? '';
71    }
72
73    protected static function newFactory()
74    {
75        return PlansFactory::new();
76    }
77}