Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 7 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
| UpdateBetaFlagRequest | |
0.00% |
0 / 7 |
|
0.00% |
0 / 2 |
12 | |
0.00% |
0 / 1 |
| authorize | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
6 | |||
| rules | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Http\Requests\v2\User; |
| 4 | |
| 5 | use App\Http\Models\Auth\Role; |
| 6 | use Illuminate\Foundation\Http\FormRequest; |
| 7 | |
| 8 | /** |
| 9 | * Request for updating a user's beta flag (VENGRESO_ADMIN only). |
| 10 | * |
| 11 | * @property bool $is_beta Whether the user should have access to beta features |
| 12 | */ |
| 13 | class UpdateBetaFlagRequest extends FormRequest |
| 14 | { |
| 15 | /** |
| 16 | * Determine if the user is authorized to make this request. |
| 17 | * |
| 18 | * Only users with the VENGRESO_ADMIN role can update user beta flags. |
| 19 | */ |
| 20 | public function authorize(): bool |
| 21 | { |
| 22 | $user = $this->user(); |
| 23 | |
| 24 | if (! $user) { |
| 25 | return false; |
| 26 | } |
| 27 | |
| 28 | return in_array(Role::VENGRESO_ADMIN, $user->roles()); |
| 29 | } |
| 30 | |
| 31 | /** |
| 32 | * Get the validation rules that apply to the request. |
| 33 | * |
| 34 | * @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string> |
| 35 | */ |
| 36 | public function rules(): array |
| 37 | { |
| 38 | return [ |
| 39 | 'is_beta' => 'required|boolean', |
| 40 | ]; |
| 41 | } |
| 42 | } |