Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 33
0.00% covered (danger)
0.00%
0 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
UpdateAddOnRequest
0.00% covered (danger)
0.00%
0 / 33
0.00% covered (danger)
0.00%
0 / 2
6
0.00% covered (danger)
0.00%
0 / 1
 authorize
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
2
 rules
0.00% covered (danger)
0.00%
0 / 30
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3namespace App\Http\Requests\v2\AddOn;
4
5use App\Http\Models\Auth\Role;
6use Illuminate\Foundation\Http\FormRequest;
7
8class UpdateAddOnRequest extends FormRequest
9{
10    public function authorize(): bool
11    {
12        $user = $this->user();
13
14        $roles = $user->roles();
15
16        return in_array(Role::VENGRESO_ADMIN, $roles);
17    }
18
19    /**
20     * Get the validation rules that apply to the request.
21     *
22     * @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
23     */
24    public function rules(): array
25    {
26        return [
27            'name' => 'sometimes|string|max:255',
28            'stripe_price_id' => 'sometimes|string|max:255',
29            'price' => 'sometimes|numeric',
30            'priority' => 'sometimes|integer',
31            'product' => 'sometimes|string|max:255',
32            'description' => 'sometimes|string|max:255',
33            'stripe_id' => 'sometimes|string|max:255',
34            'features' => 'sometimes|array',
35            'features.project_credits' => 'sometimes|integer',
36            'features.monthly_total_time_credits' => 'sometimes|integer',
37            'features.monthly_roleplay_credits' => 'sometimes|integer',
38            'hubspot_fields' => 'sometimes|array',
39            'hubspot_fields.*' => 'sometimes|string|max:255|nullable',
40            'hubspot_fields.hubspot_cancel_subscription_date' => 'sometimes|string|max:255|nullable',
41            'hubspot_fields.hubspot_name' => 'sometimes|string|max:255|nullable',
42            'hubspot_fields.hubspot_payment_status' => 'sometimes|string|max:255|nullable',
43            'hubspot_fields.hubspot_subscription_annual_recurring_revenue' => 'sometimes|string|max:255|nullable',
44            'hubspot_fields.hubspot_subscription_churn_date' => 'sometimes|string|max:255|nullable',
45            'hubspot_fields.hubspot_subscription_expiration_date' => 'sometimes|string|max:255|nullable',
46            'hubspot_fields.hubspot_subscription_frequency' => 'sometimes|string|max:255|nullable',
47            'hubspot_fields.hubspot_subscription_monthly_recurring_revenue' => 'sometimes|string|max:255|nullable',
48            'hubspot_fields.hubspot_subscription_plan_type' => 'sometimes|string|max:255|nullable',
49            'hubspot_fields.hubspot_subscription_start_date' => 'sometimes|string|max:255|nullable',
50            'hubspot_fields.hubspot_subscription_status' => 'sometimes|string|max:255|nullable',
51            'hubspot_fields.hubspot_subscription_status_updated_on' => 'sometimes|string|max:255|nullable',
52            'hubspot_fields.hubspot_user_type' => 'sometimes|string|max:255|nullable',
53            'hubspot_fields.hubspot_last_product' => 'sometimes|string|max:255|nullable',
54            'is_recurrent' => 'sometimes|boolean',
55        ];
56    }
57}