feat: Agregar campo 'telefono' a la inscripción de vehículos y actualizar las reglas de validación en VehicleStoreRequest

This commit is contained in:
Juan Felipe Zapata Moreno 2025-11-26 10:23:51 -06:00
parent dfb60806cb
commit 975c6863ff
5 changed files with 5 additions and 4 deletions

View File

@ -40,6 +40,7 @@ public function vehicleInscription(VehicleStoreRequest $request)
$folio = $request->input('folio');
$tagNumber = $request->input('tag_number');
$niv = $request->input('niv');
$telefono = $request->input('telefono');
// Buscar Tag y validar que NO tenga vehículo asignado
$tag = Tag::where('folio', $folio)->where('tag_number', $tagNumber)->first();
@ -98,6 +99,7 @@ public function vehicleInscription(VehicleStoreRequest $request)
'num_int' => $ownerData['num_int'],
'colonia' => $ownerData['colonia'],
'cp' => $ownerData['cp'],
'telefono' => $telefono
]
);
@ -114,7 +116,6 @@ public function vehicleInscription(VehicleStoreRequest $request)
'clase_veh' => $vehicleData['clase_veh'],
'tipo_servicio' => $vehicleData['tipo_servicio'],
'rfv' => $vehicleData['rfv'],
'rfc' => $vehicleData['rfc'],
'ofcexpedicion' => $vehicleData['ofcexpedicion'],
'fechaexpedicion' => $vehicleData['fechaexpedicion'],
'tipo_veh' => $vehicleData['tipo_veh'],

View File

@ -16,6 +16,7 @@ public function rules(): array
'folio' => ['required', 'string', 'max:50'],
'tag_number' => ['required', 'string', 'exists:tags,tag_number'],
'niv' => ['sometimes', 'string', 'max:30'],
'telefono' => ['required', 'string', 'max:11'],
'files' => ['nullable', 'array', 'min:1'],
'files.*' => ['file', 'mimes:jpeg,png,jpg', 'max:10240'],
'names' => ['nullable', 'array'],
@ -32,6 +33,8 @@ public function messages(): array
'tag_number.exists' => 'El tag_number no existe en el sistema',
'niv.required' => 'El niv es requerido',
'niv.string' => 'El niv debe ser una cadena de texto',
'telefono.required' => 'El teléfono es requerido',
'telefono.max' => 'El teléfono no debe superar los 10 caracteres',
'files.array' => 'Los archivos deben ser un array',
'files.*.file' => 'Cada elemento debe ser un archivo válido',
'files.*.mimes' => 'Los archivos deben ser de tipo: jpeg, png, jpg, pdf',

View File

@ -23,7 +23,6 @@ class Vehicle extends Model
'clase_veh',
'tipo_servicio',
'rfv',
'rfc',
'ofcexpedicion',
'fechaexpedicion',
'tipo_veh',

View File

@ -135,7 +135,6 @@ public function extraerDatosVehiculo(array $datos): array
'clase_veh' => $datos['clase_veh'] ?? null,
'tipo_servicio' => $datos['tipo_uso'] ?? null,
'rfv' => $datos['rfv'] ?? null,
'rfc' => $datos['rfc'] ?? null,
'ofcexpedicion' => $datos['ofcexp'] ?? null,
'fechaexpedicion' => $datos['fechaexp'] ?? null,
'tipo_veh' => $datos['tipo_veh'] ?? null,

View File

@ -24,7 +24,6 @@ public function up(): void
$table->string('clase_veh')->nullable();
$table->string('tipo_servicio')->nullable();
$table->string('rfv')->unique()->nullable();
$table->string('rfc')->nullable();
$table->string('ofcexpedicion')->nullable();
$table->date('fechaexpedicion')->nullable();
$table->string('tipo_veh')->nullable();