a bit of progress

This commit is contained in:
2026-07-04 17:09:55 +03:00
parent f6e7d37428
commit 082b532d52
29 changed files with 2734 additions and 47 deletions
+41
View File
@@ -0,0 +1,41 @@
<?php
namespace App\Http\Requests\Game;
use Illuminate\Foundation\Http\FormRequest;
class AttackRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
'mug' => ['sometimes', 'boolean'],
'hit' => ['sometimes', 'boolean'],
];
}
/**
* Get custom messages for validator errors.
*
* @return array<string, string>
*/
public function messages(): array
{
return [
'mug.boolean' => 'The mug option must be a boolean value.',
];
}
}
@@ -0,0 +1,41 @@
<?php
namespace App\Http\Requests\Game;
use Illuminate\Foundation\Http\FormRequest;
class AttemptCrimeRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
'crime_id' => ['required', 'exists:crimes,id'],
];
}
/**
* Get custom messages for validator errors.
*
* @return array<string, string>
*/
public function messages(): array
{
return [
'crime_id.required' => 'You must select a crime to attempt.',
'crime_id.exists' => 'The selected crime does not exist.',
];
}
}
@@ -0,0 +1,43 @@
<?php
namespace App\Http\Requests\Game;
use Illuminate\Foundation\Http\FormRequest;
class CharacterDepositRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
'amount' => ['required', 'integer', 'min:1', 'max:1000000'],
];
}
/**
* Get custom messages for validator errors.
*
* @return array<string, string>
*/
public function messages(): array
{
return [
'amount.required' => 'You must enter an amount to deposit.',
'amount.integer' => 'The amount must be a whole number.',
'amount.min' => 'The minimum deposit amount is :min.',
'amount.max' => 'The maximum deposit amount is :max.',
];
}
}
@@ -0,0 +1,43 @@
<?php
namespace App\Http\Requests\Game;
use Illuminate\Foundation\Http\FormRequest;
class CharacterWithdrawRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
'amount' => ['required', 'integer', 'min:1', 'max:1000000'],
];
}
/**
* Get custom messages for validator errors.
*
* @return array<string, string>
*/
public function messages(): array
{
return [
'amount.required' => 'You must enter an amount to withdraw.',
'amount.integer' => 'The amount must be a whole number.',
'amount.min' => 'The minimum withdrawal amount is :min.',
'amount.max' => 'The maximum withdrawal amount is :max.',
];
}
}
+42
View File
@@ -0,0 +1,42 @@
<?php
namespace App\Http\Requests\Game;
use Illuminate\Foundation\Http\FormRequest;
class TrainRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
'stat' => ['required', 'string', 'in:strength,defense,speed,dexterity'],
];
}
/**
* Get custom messages for validator errors.
*
* @return array<string, string>
*/
public function messages(): array
{
return [
'stat.required' => 'You must select a stat to train.',
'stat.string' => 'The stat must be a string.',
'stat.in' => 'The selected stat is invalid. Valid stats are: strength, defense, speed, dexterity.',
];
}
}