Carga inicial
This commit is contained in:
84
app/Http/Requests/Administrador/ClientesRequest.php
Normal file
84
app/Http/Requests/Administrador/ClientesRequest.php
Normal file
@@ -0,0 +1,84 @@
|
||||
<?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'
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user