Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
8 / 8 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| StoreCompanyProjectRequest | |
100.00% |
8 / 8 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
| authorize | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| rules | |
100.00% |
7 / 7 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Http\Requests\CompanyRolePlay; |
| 4 | |
| 5 | use App\Http\Models\RolePlayProjects; |
| 6 | use Illuminate\Foundation\Http\FormRequest; |
| 7 | use Illuminate\Validation\Rule; |
| 8 | |
| 9 | /** |
| 10 | * Request validation for creating a new company roleplay project. |
| 11 | * |
| 12 | * @property string $name The project name (required, max 255 chars) |
| 13 | * @property string $type The call type ('cold-call' or 'discovery-call') |
| 14 | * @property string|null $description Optional project description |
| 15 | * @property string $industry The target industry |
| 16 | * @property array<string> $target_job_titles Array of targeted job titles (at least 1) |
| 17 | * @property array<string>|null $key_features Optional array of key product/service features |
| 18 | * @property string|null $product_description Optional product description |
| 19 | * @property int $difficulty_level Difficulty level (1-5) |
| 20 | * @property array<array{id: int, company_name: string, company_size: string, budget: string, decision_making: string, urgency_level: string, openess_to_new_solutions: string, communication_style: string, pain_points: string, current_solution: string, personality: string}> $customer_profiles Array of customer profile objects (at least 1) |
| 21 | * @property array<array{name: string, is_default: bool, weight: int, criteria: array}> $scorecard_config Array of scorecard config objects (at least 1) |
| 22 | * @property array<array{category: string, options: array<string>}> $objections Array of objection objects (at least 1) |
| 23 | * @property bool|null $allow_user_customization Whether users can customize when cloning (default: true) |
| 24 | * @property array<string>|null $assigned_groups Optional array of group IDs (empty means all users) |
| 25 | * @property string|null $status Project status ('active', 'inactive', 'archived'; default: 'draft') |
| 26 | */ |
| 27 | class StoreCompanyProjectRequest extends FormRequest |
| 28 | { |
| 29 | /** |
| 30 | * Determine if the user is authorized to make this request. |
| 31 | * |
| 32 | * Authorization is handled in the controller by checking company_id. |
| 33 | */ |
| 34 | public function authorize(): bool |
| 35 | { |
| 36 | return true; |
| 37 | } |
| 38 | |
| 39 | /** |
| 40 | * Get the validation rules that apply to the request. |
| 41 | * |
| 42 | * @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string> |
| 43 | */ |
| 44 | public function rules(): array |
| 45 | { |
| 46 | return array_merge(RolePlayProjects::getRules(), [ |
| 47 | 'product_description' => 'nullable|string', |
| 48 | 'allow_user_customization' => 'sometimes|boolean', |
| 49 | 'assigned_groups' => 'sometimes|array', |
| 50 | 'assigned_groups.*' => 'string', |
| 51 | 'status' => ['sometimes', 'string', Rule::in(['active', 'inactive', 'archived', 'draft'])], |
| 52 | ]); |
| 53 | } |
| 54 | } |