mirror of
https://github.com/robonen/metr.git
synced 2026-03-20 02:44:42 +00:00
User authentication
This commit is contained in:
21
backend/app/Http/Requests/Auth/LoginRequest.php
Normal file
21
backend/app/Http/Requests/Auth/LoginRequest.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Auth;
|
||||
|
||||
use App\Http\Requests\BaseRequest;
|
||||
|
||||
class LoginRequest extends BaseRequest
|
||||
{
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'email' => ['required', 'string', 'email', 'exists:users'],
|
||||
'password' => ['required', 'string'],
|
||||
];
|
||||
}
|
||||
}
|
||||
21
backend/app/Http/Requests/Auth/RegistrationRequest.php
Normal file
21
backend/app/Http/Requests/Auth/RegistrationRequest.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Auth;
|
||||
|
||||
use App\Http\Requests\BaseRequest;
|
||||
|
||||
class RegistrationRequest extends BaseRequest
|
||||
{
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'email' => ['required', 'string', 'email', 'unique:users'],
|
||||
'password' => ['required', 'string'],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -15,11 +15,12 @@ class StoreOfferRequest extends BaseRequest
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'owner_id' => ['required', 'numeric', 'exists:users,id'],
|
||||
'user_id' => ['required', 'numeric', 'exists:users,id'],
|
||||
'name' => ['required', 'string'],
|
||||
'type' => ['required', new Enum(OrderTypesEnum::class)],
|
||||
'price' => ['required', 'numeric'],
|
||||
'rooms' => ['required', 'numeric'],
|
||||
'price' => ['required', 'numeric', 'min:0.1'],
|
||||
'rooms' => ['required', 'numeric', 'min:1'],
|
||||
'space' => ['required', 'numeric', 'min:1'],
|
||||
'yandex_mark' => ['string'],
|
||||
'location' => ['required', 'string'],
|
||||
'description' => ['required', 'string'],
|
||||
|
||||
@@ -14,8 +14,6 @@ class StoreOrderRequest extends BaseRequest
|
||||
return [
|
||||
'offer_id' => ['required', 'numeric', 'exists:offers,id'],
|
||||
'user_id' => ['required', 'numeric', 'exists:users,id'],
|
||||
'start_date' => ['required', 'date', 'after_or_equal:today'],
|
||||
'end_date' => ['required', 'date', 'after_or_equal:tomorrow'],
|
||||
'price' => ['required', 'numeric', 'min:0.1'],
|
||||
'discount' => ['required', 'numeric', 'min:0'],
|
||||
];
|
||||
|
||||
@@ -15,11 +15,12 @@ class UpdateOfferRequest extends BaseRequest
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'owner_id' => ['numeric', 'exists:users,id'],
|
||||
'user_id' => ['numeric', 'exists:users,id'],
|
||||
'name' => ['string'],
|
||||
'type' => [new Enum(OrderTypesEnum::class)],
|
||||
'price' => ['numeric'],
|
||||
'rooms' => ['numeric'],
|
||||
'price' => ['numeric', 'min:0.1'],
|
||||
'rooms' => ['numeric', 'min:1'],
|
||||
'space' => ['numeric', 'min:1'],
|
||||
'yandex_mark' => ['string'],
|
||||
'location' => ['string'],
|
||||
'description' => ['string'],
|
||||
|
||||
@@ -14,8 +14,6 @@ class UpdateOrderRequest extends BaseRequest
|
||||
return [
|
||||
'offer_id' => ['numeric', 'exists:offers,id'],
|
||||
'user_id' => ['numeric', 'exists:users,id'],
|
||||
'start_date' => ['date'],
|
||||
'end_date' => ['date'],
|
||||
'price' => ['numeric', 'min:0.1'],
|
||||
'discount' => ['numeric', 'min:0.1'],
|
||||
];
|
||||
|
||||
22
backend/app/Http/Requests/UpdateUserRequest.php
Normal file
22
backend/app/Http/Requests/UpdateUserRequest.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
class UpdateUserRequest extends BaseRequest
|
||||
{
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'first_name' => ['string'],
|
||||
'last_name' => ['string'],
|
||||
'middle_name' => ['string'],
|
||||
'email' => ['string', 'email', 'unique:users'],
|
||||
'phone' => ['string'],
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user