49 lines
1.2 KiB
PHP
49 lines
1.2 KiB
PHP
<?php
|
|
namespace App\Http\Requests\Administrador;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class FormasPagosRequest 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['formas_pago'];
|
|
|
|
return [
|
|
'nombre' => 'string|required|min:1|max:191|unique:cat_formas_pagos,nombre,'.$id.',id',
|
|
'zeros' => 'string|min:1|max:1',
|
|
];
|
|
}else{
|
|
return [
|
|
'nombre' => 'string|required|min:1|max:191|unique:cat_formas_pagos,nombre',
|
|
'zeros' => 'string|min:1|max:1',
|
|
];
|
|
}
|
|
}
|
|
|
|
public function messages()
|
|
{
|
|
$messages = [
|
|
'nombre.unique' => 'El nombre que ingresó ya se encuentra en nuestros registros.'
|
|
];
|
|
return $messages;
|
|
}
|
|
}
|