Refactor project structure to use domain-oriented architecture; add Product and Tenant domains with controllers, models, requests, resources, and routes

This commit is contained in:
2026-06-19 11:59:28 -03:00
parent 507b81b54e
commit 93a2750d33
31 changed files with 681 additions and 163 deletions

View File

@@ -0,0 +1,38 @@
<?php
namespace App\Domains\Product\Requests;
use App\Domains\Product\Models\Product;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
class UpdateProductRequest extends FormRequest
{
public function authorize(): bool
{
return true;
}
/**
* @return array<string, mixed>
*/
public function rules(): array
{
/** @var Product|null $product */
$product = $this->route('producto');
return [
'tenant_codigo' => ['required', 'string', 'exists:tenants,codigo'],
'categoria_id' => ['required', 'integer'],
'slug' => [
'required',
'string',
'max:255',
Rule::unique('productos', 'slug')->ignore($product?->id),
],
'nombre' => ['required', 'string', 'max:255'],
'descripcion' => ['nullable', 'string'],
'precio' => ['required', 'numeric', 'min:0'],
];
}
}