This commit is contained in:
2026-02-03 15:31:29 +05:00
commit 326c677e8d
2800 changed files with 1489388 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
<?php
namespace App\Http\Requests\Api\System\VersionManagement;
use App\Models\System\Settings\OS;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
class CheckForUpdateRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array|string>
*/
public function rules(): array
{
return [
/** @example 1.0.0 */
'version' => ['required', 'string', 'max:255'],
/** @example ios */
'os' => ['required', 'string', 'max:255', Rule::in(array_keys(OS::apps()))],
];
}
/**
* Get the error messages for the defined validation rules.
*
* @return array<string, string>
*/
public function messages(): array
{
return [
'os.in' => sprintf('Valid sources: %s', implode(', ', array_keys(OS::apps()))),
];
}
}

View File

@@ -0,0 +1,37 @@
<?php
namespace App\Http\Requests\Api\V1\Auth;
use App\Rules\VerificationRule;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
class AuthLoginRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array|string>
*/
public function rules(): array
{
return [
/**
* @example 61929248
*/
'phone_number' => ['required', 'integer', 'between:61000000,71999999', Rule::exists('users', 'phone_number')],
];
}
/**
* Get the error messages for the defined validation rules.
*
* @return array<string, string>
*/
public function messages(): array
{
return [
'phone_number.exists' => __('User with this phone number does not exist'),
];
}
}

View File

@@ -0,0 +1,29 @@
<?php
namespace App\Http\Requests\Api\V1\Auth;
use App\Rules\VerificationRule;
use Illuminate\Foundation\Http\FormRequest;
class AuthVerifyRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array|string>
*/
public function rules(): array
{
return [
/**
* @example 61929248
*/
'phone_number' => ['required', 'integer', 'between:61000000,65999999'],
/**
* @example 99934
*/
'code' => ['required', 'integer', new VerificationRule($this->phone_number)],
];
}
}

View File

@@ -0,0 +1,22 @@
<?php
namespace App\Http\Requests\Api\V1\Brand;
use App\Models\Ecommerce\Product\Brand\Brand;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
class BrandIndexRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
'type' => ['nullable', 'string', Rule::in(Brand::types())],
];
}
}

View File

@@ -0,0 +1,33 @@
<?php
namespace App\Http\Requests\Api\V1\Brand;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
class BrandProductsRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
'lang' => ['nullable', 'string', Rule::in(array_keys(config('app.locales')))],
'perPage' => ['nullable', 'integer'],
];
}
/**
* Handle a passed validation attempt.
*/
protected function passedValidation(): void
{
$this->merge([
'lang' => $this->lang ?: config('app.locale'),
'perPage' => $this->perPage ?: 6,
]);
}
}

View File

@@ -0,0 +1,21 @@
<?php
namespace App\Http\Requests\Api\V1\Cart;
use Illuminate\Foundation\Http\FormRequest;
class CartAddProductRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array<string, array>
*/
public function rules(): array
{
return [
'product_id' => ['required', 'integer', 'exists:products,id'],
'quantity' => ['nullable', 'integer'],
];
}
}

View File

@@ -0,0 +1,20 @@
<?php
namespace App\Http\Requests\Api\V1\Cart;
use Illuminate\Foundation\Http\FormRequest;
class CartRemoveRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
'product_id' => ['required', 'integer', 'exists:products,id'],
];
}
}

View File

@@ -0,0 +1,22 @@
<?php
namespace App\Http\Requests\Api\V1\Cart;
use App\Rules\ProductStockIsAvailable;
use Illuminate\Foundation\Http\FormRequest;
class CartStoreRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
'product_id' => ['required', 'integer', new ProductStockIsAvailable($this->product_quantity)],
'product_quantity' => ['required', 'integer', 'min:1'],
];
}
}

View File

@@ -0,0 +1,21 @@
<?php
namespace App\Http\Requests\Api\V1\Category;
use Illuminate\Foundation\Http\FormRequest;
class CategoryIndexRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
'type' => ['nullable', 'string', 'in:root,tree'],
'group' => ['nullable', 'string', 'in:market'],
];
}
}

View File

@@ -0,0 +1,52 @@
<?php
namespace App\Http\Requests\Api\V1\Forms\ContactUS;
use App\Models\System\Settings\OS;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
class ContactUSStoreRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
'phone' => ['required', 'integer', 'between:61000000,71999999'],
'title' => ['required', 'string', 'max:255'],
'content' => ['required', 'string', 'max:1000'],
'type' => ['required', 'string', Rule::in(OS::MOBILE_APP, OS::MOBILE_ADMIN)],
];
}
/**
* Body Parameters for scribe
*
* @return array<string, array<string, string>>
*/
public function bodyParameters(): array
{
return [
'phone' => [
'description' => 'Phone number',
'example' => '61929248',
],
'title' => [
'description' => 'Message title',
'example' => 'Hello',
],
'content' => [
'description' => 'Message content',
'example' => 'Awesome JOB',
],
'type' => [
'description' => 'From where?',
'example' => 'mobile_app',
],
];
}
}

View File

@@ -0,0 +1,20 @@
<?php
namespace App\Http\Requests\Api\V1\Forms\Newsletter;
use Illuminate\Foundation\Http\FormRequest;
class NewsletterSubscriptionStoreRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
'email' => ['required', 'email', 'max:255'],
];
}
}

View File

@@ -0,0 +1,33 @@
<?php
namespace App\Http\Requests\Api\V1\Product;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
class BasicProductIndexRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
'lang' => ['nullable', 'string', Rule::in(array_keys(config('app.locales')))],
'perPage' => ['nullable', 'integer'],
];
}
/**
* Handle a passed validation attempt.
*/
protected function passedValidation(): void
{
$this->merge([
'lang' => $this->lang ?: config('app.locale'),
'perPage' => $this->perPage ?: 6,
]);
}
}

View File

@@ -0,0 +1,20 @@
<?php
namespace App\Http\Requests\Api\V1\Product;
use Illuminate\Foundation\Http\FormRequest;
class ProductCommentStore extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
'comment' => ['required', 'string', 'max:255'],
];
}
}

View File

@@ -0,0 +1,33 @@
<?php
namespace App\Http\Requests\Api\V1\Product;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
class ProductIndexRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
'lang' => ['nullable', 'string', Rule::in(array_keys(config('app.locales')))],
'perPage' => ['nullable', 'integer'],
];
}
/**
* Handle a passed validation attempt.
*/
protected function passedValidation(): void
{
$this->merge([
'lang' => $this->lang ?: config('app.locale'),
'perPage' => $this->perPage ?: 6,
]);
}
}

View File

@@ -0,0 +1,37 @@
<?php
namespace App\Http\Requests\Api\V1\Product\Review;
use App\Models\System\Settings\OS;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
class ProductReviewStore extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
'rating' => ['required', 'numeric', 'max:5'],
'title' => ['required', 'string', 'max:255'],
'content' => ['nullable', 'string', 'max:255'],
'source' => ['required', 'string', Rule::in(array_keys(OS::apps()))],
];
}
/**
* Get the error messages for the defined validation rules.
*
* @return array<string, string>
*/
public function messages(): array
{
return [
'source.in' => sprintf('Valid sources: %s', implode(', ', array_keys(OS::apps()))),
];
}
}

View File

@@ -0,0 +1,22 @@
<?php
namespace App\Http\Requests\Api\V1\Product\Review;
use Illuminate\Foundation\Http\FormRequest;
class ProductReviewUpdate extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
'rating' => ['required', 'numeric', 'max:5'],
'title' => ['required', 'string', 'max:255'],
'content' => ['nullable', 'string', 'max:255'],
];
}
}