ldc-gen-game-web/app/Http/Requests/GenerateCodesRequest.php
Jérémy Munsch 2831d422c9
Refactorize Settings BO save
- require composer kwaadpepper/enum
- User->role is now an enum
- Add isLocal and isAdmin to user model
- changed multiple fields casts on model Settings
- added validation for settings
2022-03-11 09:59:40 +01:00

34 lines
732 B
PHP

<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class GenerateCodesRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return boolean
*/
public function authorize()
{
// ? Is auth and super admin
/** @var \App\Models\User $user */
$user = auth()->user();
return auth()->check() and $user->isAdmin();
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'quantity' => 'required|integer|min:1',
'code_length' => 'required|integer|min:1',
];
}
}