wip
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\V1\Entrepreneur\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class VendorProductStoreRequest 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 [
|
||||
// essentials...
|
||||
'name' => ['required', 'string', 'max:255'],
|
||||
'description' => ['nullable', 'string', 'max:255'],
|
||||
'files' => ['nullable'],
|
||||
|
||||
// prices...
|
||||
'cost_amount' => ['required', 'numeric'],
|
||||
'old_price_amount' => ['nullable', 'numeric', 'gt:cost_amount'],
|
||||
|
||||
// relationships...
|
||||
// 'integer', 'exists:brands,id'
|
||||
'brand_id' => ['nullable'],
|
||||
'category_ids' => ['required', 'array'],
|
||||
'collection_ids' => ['nullable', 'array'],
|
||||
|
||||
// inventories...
|
||||
'stock' => ['required', 'integer', 'min:1'],
|
||||
'sku' => ['nullable', 'string', 'max:255'],
|
||||
'barcode' => ['nullable', 'string', 'max:255', 'unique:products,barcode'],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\V1\Entrepreneur\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class VendorProductUpdateRequest 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 [
|
||||
// essentials...
|
||||
'name' => ['required', 'string', 'max:255'],
|
||||
'description' => ['nullable', 'string', 'max:255'],
|
||||
'new_imgs' => ['nullable'],
|
||||
'deleted_images' => ['nullable'],
|
||||
|
||||
// prices...
|
||||
'cost_amount' => ['required', 'numeric'],
|
||||
'old_price_amount' => ['nullable', 'numeric', 'gt:cost_amount'],
|
||||
|
||||
// relationships...
|
||||
'brand_id' => ['nullable', 'integer', 'exists:brands,id'],
|
||||
'category_ids' => ['required', 'array'],
|
||||
'collection_ids' => ['nullable', 'array'],
|
||||
|
||||
// inventories...
|
||||
'stock' => ['required', 'integer', 'min:1'],
|
||||
'sku' => ['nullable', 'string', 'max:255'],
|
||||
'barcode' => ['nullable', 'string', 'max:255'],
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user