Created
September 18, 2019 22:09
-
-
Save erikfig/5dbf2dd365c95d66439e3d21fcaf3e93 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Created by PhpStorm. | |
* User: honorato | |
* Date: 09/08/19 | |
* Time: 08:31 | |
*/ | |
namespace Modules\ContasAPagar\Http\Requests; | |
use Illuminate\Foundation\Http\FormRequest; | |
class ContasAPagarRequest extends FormRequest | |
{ | |
/** | |
* Determine if the user is authorized to make this request. | |
* | |
* @return bool | |
*/ | |
public function authorize() | |
{ | |
return true; | |
} | |
//TODO pode tirar quando o Tenant estiver implementado | |
public function prepareForValidation(){ | |
$input = $this->all(); | |
$this->replace($input); | |
} | |
/** | |
* Get the validation rules that apply to the request. | |
* | |
* @return array | |
*/ | |
public function rules() | |
{ | |
return [ | |
'contratante_id' => 'required|integer', | |
'agente_id' => 'integer|exists:tenant.agentes,id,deleted_at,NULL', | |
'tipo_titulo' => 'required|max:1', | |
'num_documento' => 'required|max:20', | |
'dt_emissao' => 'date_format:Y-m-d', | |
'indice_econ_id' => 'required|integer|exists:tenant.indice_economico,id,deleted_at,NULL', | |
'valor' => 'required|numeric', | |
'dt_vencimento' => 'required|date_format:Y-m-d', | |
// 'valor_desconto' => 'numeric', | |
// 'dt_limite_desconto' => 'date_format:Y-m-d', | |
'cod_barras' => 'max:60', | |
// 'multa' => 'numeric', | |
// 'mora_dia' => 'numeric', | |
'dt_limite_pg_bancario' => 'date_format:Y-m-d', | |
'dt_fluxo_caixa' => 'required|date_format:Y-m-d', | |
// 'tipo_operacao_id' => 'integer|exists:tipo_operacao,id,deleted_at,NULL', | |
// 'tipo_operacao' => 'exists:tipo_operacao,de_para,deleted_at,NULL', | |
// 'centro_custo_id' => 'integer|exists:centro_custo,id,deleted_at,NULL', | |
// 'centro_custo' => 'exists:centro_custo,de_para,deleted_at,NULL', | |
'observacao' => 'max:200', | |
// 'dt_pagamento' => 'date_format:Y-m-d', | |
// 'cotacao_indice_econ_dt_pg' => 'numeric', | |
// 'vl_pago_moeda_origen' => 'numeric', | |
// 'vl_pago_moeda_base' => 'numeric', | |
// 'situacao_titulo' => 'max:2', | |
// 'conta_recorrente_id' => 'integer|exists:conta_recorrente,id,deleted_at,NULL', | |
]; | |
} | |
/** | |
* @return array | |
*/ | |
public function attributes() | |
{ | |
return [ | |
'contratante_id' => 'ID da Contratante', | |
'agente_id' => 'ID do Agente', | |
'tipo_titulo' => 'Tipo do Título', | |
'num_documento' => 'Número do Documento', | |
'dt_emissao' => 'Data de Emissão', | |
'indice_econ_id' => 'Índice Econômico', | |
'valor' => 'Valor do Documento', | |
'dt_vencimento' => 'Data de Vencimento', | |
'valor_desconto' => 'Valor do Desconto', | |
'dt_limite_desconto' => 'Data Limite do Desconto', | |
'cod_barras' => 'Código de Barras', | |
'multa' => 'Multa', | |
'mora_dia' => 'Mora por Dia', | |
'dt_limite_pg_bancario' => 'Data Limite para Pagamento Bancário', | |
'dt_fluxo_caixa' => 'Data do Fluxo de Caixa', | |
'tipo_operacao_id' => 'Tipo de Operação', | |
'tipo_operacao' => 'Tipo de Operação', | |
'centro_custo_id' => 'Centro de Custo', | |
'centro_custo' => 'Centro de Custo', | |
'observacao' => 'Observação', | |
'dt_pagamento' => 'Data do Pagamento', | |
'cotacao_indice_econ_dt_pg' => 'Cotação do Índice Econômico na data de Pagamento', | |
'vl_pago_moeda_origen' => 'Valor pago na moeda de origem', | |
'vl_pago_moeda_base' => 'Valor pago na moeda base', | |
'situacao_titulo' => 'Situação do Título', | |
'conta_recorrente_id' => 'Conta Corrente para Pagamento', | |
]; | |
} | |
/** | |
* Custom message for validation | |
* | |
* @return array | |
*/ | |
public function messages() | |
{ | |
return [ | |
'required' => 'O(A) :attribute é obrigatório(a)!', | |
'max' => 'O(A) :attribute deve ter no máximo :max caracteres!', | |
'integer' => 'O(A) :attribute deve ser um inteiro!', | |
'numeric' => 'O :attribute deve ser numérico, com separação de casa decimal com ponto!', | |
'date_format' => 'O :attribute deve estar no formato de data (AAAA-MM-DD)!', | |
'exists' => ':attribute não encontrado(a) na base de dados', | |
]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment