Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
12.50% |
1 / 8 |
|
50.00% |
1 / 2 |
CRAP | |
0.00% |
0 / 1 |
| CompanyTrait | |
12.50% |
1 / 8 |
|
50.00% |
1 / 2 |
4.68 | |
0.00% |
0 / 1 |
| getCompanyBySlug | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getPlanLicenseProperty | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Traits; |
| 4 | |
| 5 | use App\Http\Models\Admin\Company; |
| 6 | use App\Http\Models\Plans; |
| 7 | |
| 8 | trait CompanyTrait |
| 9 | { |
| 10 | public function getCompanyBySlug($slug) |
| 11 | { |
| 12 | return Company::where('slug', $slug)->first(); |
| 13 | } |
| 14 | |
| 15 | public function getPlanLicenseProperty(Plans $plan): string { |
| 16 | return match ($plan->identifier) { |
| 17 | 'starter', 'starter-yearly' => 'total_starter_license_remaining', |
| 18 | 'growth', 'growth-yearly' => 'total_growth_license_remaining', |
| 19 | 'sales-pro-monthly', 'sales-pro-yearly' => 'total_sales_pro_license_remaining', |
| 20 | 'pro-plan-teams-ent', 'pro-plan-teams-smb' => 'total_sales_pro_teams_license_remaining', |
| 21 | default => null, |
| 22 | }; |
| 23 | } |
| 24 | } |