This commit is contained in:
2025-09-25 03:03:31 +05:00
commit ae480cf2f6
2768 changed files with 1485826 additions and 0 deletions

View File

@@ -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'],
];
}
}

View File

@@ -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'],
];
}
}