Initial commit

This commit is contained in:
James
2024-12-03 21:27:44 +01:00
commit 613e1a767c
125 changed files with 16298 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
<?php
declare(strict_types=1);
namespace App\Http\Requests\Api\V1;
use Illuminate\Foundation\Http\FormRequest;
class LoginRequest extends FormRequest
{
public function authorize(): bool
{
return true;
}
public function rules(): array
{
return [
'email' => 'required|email:rfc',
'password' => 'required',
'device_name' => 'required|string',
];
}
}

View File

@@ -0,0 +1,43 @@
<?php
declare(strict_types=1);
namespace App\Http\Requests\Api\V1;
use App\Models\User;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
class SendMoneyRequest extends FormRequest
{
public function authorize(): bool
{
return true;
}
public function rules(): array
{
return [
'recipient_email' => [
'required',
'email',
Rule::exists(User::class, 'email')->whereNot('id', $this->user()->id),
],
'amount' => [
'required',
'integer',
'min:1',
],
'reason' => [
'required',
'string',
'max:255',
],
];
}
public function getRecipient(): User
{
return User::where('email', '=', $this->input('recipient_email'))->firstOrFail();
}
}