Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
16 / 16 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| UpdatePlanRequest | |
100.00% |
16 / 16 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
| authorize | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
1 | |||
| rules | |
100.00% |
13 / 13 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Http\Requests\v2\Plan; |
| 4 | |
| 5 | use App\Http\Models\Auth\Role; |
| 6 | use Illuminate\Foundation\Http\FormRequest; |
| 7 | |
| 8 | class UpdatePlanRequest extends FormRequest |
| 9 | { |
| 10 | |
| 11 | public function authorize(): bool |
| 12 | { |
| 13 | $user = $this->user(); |
| 14 | |
| 15 | $roles = $user->roles(); |
| 16 | |
| 17 | return in_array(Role::VENGRESO_ADMIN, $roles); |
| 18 | } |
| 19 | |
| 20 | /** |
| 21 | * Get the validation rules that apply to the request. |
| 22 | * |
| 23 | * @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string> |
| 24 | */ |
| 25 | public function rules(): array |
| 26 | { |
| 27 | return [ |
| 28 | 'title' => 'sometimes|string|max:255', |
| 29 | 'stripe_id' => 'sometimes|string|max:255', |
| 30 | 'features' => 'sometimes|array', |
| 31 | 'has_fly_learning' => 'sometimes|boolean', |
| 32 | 'user_custom_prompts' => 'sometimes|integer', |
| 33 | 'user_persona_available' => 'sometimes|integer', |
| 34 | 'can_disable_flygrammar' => 'sometimes|boolean', |
| 35 | 'flycut_deployment' => 'sometimes|integer', |
| 36 | 'flygrammar_actions' => 'sometimes|integer', |
| 37 | 'prompts_per_day' => 'sometimes|integer', |
| 38 | 'regenerate_count' => 'sometimes|integer', |
| 39 | ]; |
| 40 | } |
| 41 | } |