- Nuevo modulo de historial de cambios (ServicioHistorial) - Observer para tracking automatico de cambios en servicios - Correccion de variables auxiliar en ServiciosController - Actualizacion de configuraciones y migraciones - Endpoint para consultar historial de cambios Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
85 lines
3.8 KiB
PHP
Executable File
85 lines
3.8 KiB
PHP
Executable File
<?php
|
|
|
|
namespace App\Http\Requests\Administrador;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class ClientesRequest extends FormRequest
|
|
{
|
|
/**
|
|
* Determine if the user is authorized to make this request.
|
|
*
|
|
* @return bool
|
|
*/
|
|
public function authorize()
|
|
{
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* Get the validation rules that apply to the request.
|
|
*
|
|
* @return array
|
|
*/
|
|
public function rules()
|
|
{
|
|
if($this->method()=='PUT'){
|
|
|
|
$params = $this->route()->parameters();
|
|
$id = $params['cliente'];
|
|
|
|
return [
|
|
'denominacion' => 'string|required|max:191|unique:clientes,denominacion,'.$id.',id',
|
|
'asesor_id' => 'alpha_num|required|exists:users,id',
|
|
'requiere_factura' => 'boolean|required',
|
|
'datos_fiscales.razon_social'=>'string|max:191|unique:clientes_datos_fiscales,razon_social,'.$id.',cliente_id',
|
|
'datos_fiscales.rfc'=>'string|min:12|max:13',
|
|
'datos_fiscales.email'=>'string|email|max:191',
|
|
'datos_fiscales.calle'=>'string|max:191',
|
|
'datos_fiscales.num_ext'=>'string|max:10',
|
|
'datos_fiscales.num_int'=>'nullable|max:10',
|
|
'datos_fiscales.colonia'=>'string|max:191',
|
|
'datos_fiscales.localidad'=>'string|max:191',
|
|
'datos_fiscales.municipio'=>'string|max:191',
|
|
'datos_fiscales.estado'=>'string|max:191',
|
|
'datos_fiscales.pais'=>'string|max:191',
|
|
'datos_fiscales.cp'=>'string|max:191',
|
|
'datos_fiscales.factura_uso_cfdi_id' => 'alpha_num|exists:facturas_uso_cfdi,id',
|
|
'datos_fiscales.factura_tipo_comprobante_id' => 'alpha_num|exists:facturas_tipo_comprobante,id',
|
|
'datos_fiscales.factura_metodos_pago_id' => 'alpha_num|exists:facturas_metodos_pago,id',
|
|
'datos_fiscales.factura_formas_pago_id' => 'alpha_num|exists:facturas_formas_pago,id',
|
|
'datos_fiscales.condicion_pago'=>'string|max:191',
|
|
'datos_fiscales.retencion_iva'=>'boolean',
|
|
'datos_fiscales.observacion'=>'max:191'
|
|
];
|
|
|
|
}else{
|
|
|
|
return [
|
|
'denominacion' => 'string|required|max:191|unique:clientes,denominacion',
|
|
'asesor_id' => 'alpha_num|required|exists:users,id',
|
|
'requiere_factura' => 'boolean|required',
|
|
'datos_fiscales.razon_social'=>'string|max:191|unique:clientes_datos_fiscales,razon_social',
|
|
'datos_fiscales.rfc'=>'string|min:12|max:13|unique:clientes_datos_fiscales,rfc',
|
|
'datos_fiscales.email'=>'string|email|max:191',
|
|
'datos_fiscales.calle'=>'string|max:191',
|
|
'datos_fiscales.num_ext'=>'string|max:10',
|
|
'datos_fiscales.num_int'=>'nullable|max:10',
|
|
'datos_fiscales.colonia'=>'string|max:191',
|
|
'datos_fiscales.localidad'=>'string|max:191',
|
|
'datos_fiscales.municipio'=>'string|max:191',
|
|
'datos_fiscales.estado'=>'string|max:191',
|
|
'datos_fiscales.pais'=>'string|max:191',
|
|
'datos_fiscales.cp'=>'string|max:191',
|
|
'datos_fiscales.factura_uso_cfdi_id' => 'alpha_num|exists:facturas_uso_cfdi,id',
|
|
'datos_fiscales.factura_tipo_comprobante_id' => 'alpha_num|exists:facturas_tipo_comprobante,id',
|
|
'datos_fiscales.factura_metodos_pago_id' => 'alpha_num|exists:facturas_metodos_pago,id',
|
|
'datos_fiscales.factura_formas_pago_id' => 'alpha_num|exists:facturas_formas_pago,id',
|
|
'datos_fiscales.condicion_pago'=>'string|max:191',
|
|
'datos_fiscales.retencion_iva'=>'boolean',
|
|
'datos_fiscales.observacion'=>'max:191'
|
|
];
|
|
}
|
|
}
|
|
}
|