ldc-gen-game-web/app/Http/Requests/GenerateCodesRequest.php

35 lines
732 B
PHP
Raw Normal View History

<?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',
];
}
}