reupload
This commit is contained in:
@@ -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()))),
|
||||
];
|
||||
}
|
||||
}
|
||||
37
app/Http/Requests/Api/V1/Auth/AuthLoginRequest.php
Normal file
37
app/Http/Requests/Api/V1/Auth/AuthLoginRequest.php
Normal 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'),
|
||||
];
|
||||
}
|
||||
}
|
||||
29
app/Http/Requests/Api/V1/Auth/AuthVerifyRequest.php
Normal file
29
app/Http/Requests/Api/V1/Auth/AuthVerifyRequest.php
Normal 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)],
|
||||
];
|
||||
}
|
||||
}
|
||||
22
app/Http/Requests/Api/V1/Brand/BrandIndexRequest.php
Normal file
22
app/Http/Requests/Api/V1/Brand/BrandIndexRequest.php
Normal 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())],
|
||||
];
|
||||
}
|
||||
}
|
||||
33
app/Http/Requests/Api/V1/Brand/BrandProductsRequest.php
Normal file
33
app/Http/Requests/Api/V1/Brand/BrandProductsRequest.php
Normal 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,
|
||||
]);
|
||||
}
|
||||
}
|
||||
21
app/Http/Requests/Api/V1/Cart/CartAddProductRequest.php
Normal file
21
app/Http/Requests/Api/V1/Cart/CartAddProductRequest.php
Normal 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'],
|
||||
];
|
||||
}
|
||||
}
|
||||
20
app/Http/Requests/Api/V1/Cart/CartRemoveRequest.php
Normal file
20
app/Http/Requests/Api/V1/Cart/CartRemoveRequest.php
Normal 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'],
|
||||
];
|
||||
}
|
||||
}
|
||||
22
app/Http/Requests/Api/V1/Cart/CartStoreRequest.php
Normal file
22
app/Http/Requests/Api/V1/Cart/CartStoreRequest.php
Normal 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'],
|
||||
];
|
||||
}
|
||||
}
|
||||
21
app/Http/Requests/Api/V1/Category/CategoryIndexRequest.php
Normal file
21
app/Http/Requests/Api/V1/Category/CategoryIndexRequest.php
Normal 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'],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -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',
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -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'],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -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,
|
||||
]);
|
||||
}
|
||||
}
|
||||
20
app/Http/Requests/Api/V1/Product/ProductCommentStore.php
Normal file
20
app/Http/Requests/Api/V1/Product/ProductCommentStore.php
Normal 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'],
|
||||
];
|
||||
}
|
||||
}
|
||||
33
app/Http/Requests/Api/V1/Product/ProductIndexRequest.php
Normal file
33
app/Http/Requests/Api/V1/Product/ProductIndexRequest.php
Normal 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,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -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()))),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -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'],
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user