Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
| CompanyVapiConfig | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
| forCompany | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Http\Models; |
| 4 | |
| 5 | /** |
| 6 | * CompanyVapiConfig Model |
| 7 | * |
| 8 | * Stores company-level VAPI configuration overrides for the roleplay platform. |
| 9 | * Only fields that the company wants to override from the global defaults |
| 10 | * need to be present in the vapi_overrides array. |
| 11 | * |
| 12 | * @property string $company_id The company ID this config belongs to |
| 13 | * @property array $vapi_overrides Sparse/partial VapiConfig overrides |
| 14 | * @property \Carbon\Carbon|null $created_at |
| 15 | * @property \Carbon\Carbon|null $updated_at |
| 16 | */ |
| 17 | class CompanyVapiConfig extends Moloquent |
| 18 | { |
| 19 | /** |
| 20 | * The database table used by the model. |
| 21 | * |
| 22 | * @var string |
| 23 | */ |
| 24 | protected $table = 'company_vapi_configs'; |
| 25 | |
| 26 | /** |
| 27 | * The attributes that are mass assignable. |
| 28 | * |
| 29 | * @var array<int, string> |
| 30 | */ |
| 31 | protected $fillable = [ |
| 32 | 'company_id', |
| 33 | 'vapi_overrides', |
| 34 | ]; |
| 35 | |
| 36 | /** |
| 37 | * The attributes that should be cast. |
| 38 | * |
| 39 | * @var array<string, string> |
| 40 | */ |
| 41 | protected $casts = [ |
| 42 | 'vapi_overrides' => 'array', |
| 43 | 'created_at' => 'datetime', |
| 44 | 'updated_at' => 'datetime', |
| 45 | ]; |
| 46 | |
| 47 | /** |
| 48 | * Get the VAPI config overrides for a specific company. |
| 49 | * |
| 50 | * @param string $companyId |
| 51 | * @return self|null |
| 52 | */ |
| 53 | public static function forCompany(string $companyId): ?self |
| 54 | { |
| 55 | return static::where('company_id', $companyId)->first(); |
| 56 | } |
| 57 | } |