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    ];
47
48    protected $casts = [
49        'stripe_obj' => 'array',
50        'features' => 'array',
51    ];
52
53    protected $hidden = ['stripe_obj'];
54
55    protected $appends = ['currency', 'interval', 'unit_amount'];
56
57    public function getCurrencyAttribute()
58    {
59        return $this->stripe_obj['currency'] ?? '';
60    }
61
62    public function getIntervalAttribute()
63    {
64        return $this->stripe_obj['recurring']['interval'] ?? '';
65    }
66
67    public function getUnitAmountAttribute()
68    {
69        return $this->stripe_obj['unit_amount'] ?? '';
70    }
71
72    protected static function newFactory()
73    {
74        return PlansFactory::new();
75    }
76}