ldc-gen-game-web/app/Http/Requests/CodeSearchRequest.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

33 lines
677 B
PHP

<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class CodeSearchRequest 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 [
'code' => 'required|string|min:1|max:25'
];
}
}