- 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>
55 lines
1.4 KiB
PHP
Executable File
55 lines
1.4 KiB
PHP
Executable File
<?php
|
|
|
|
namespace App\Http\Requests\Administrador;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class EstatusServiciosRequest 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['estatus_servicio'];
|
|
|
|
return [
|
|
'nombre' => 'string|required|min:1|max:191|unique:cat_estatus_servicios,nombre,'.$id.',id',
|
|
'color_1' => 'required|regex:/^(?=.*#[a-fA-F0-9]{6}).+$/',
|
|
'color_2' => 'regex:/^(?=.*#[a-fA-F0-9]{6}).+$/',
|
|
];
|
|
|
|
}else{
|
|
|
|
return [
|
|
'nombre' => 'string|required|min:1|max:191|unique:cat_estatus_servicios,nombre',
|
|
'color_1' => 'required|regex:/^(?=.*#[a-fA-F0-9]{6}).+$/',
|
|
'color_2' => 'regex:/^(?=.*#[a-fA-F0-9]{6}).+$/',
|
|
];
|
|
}
|
|
}
|
|
|
|
public function messages()
|
|
{
|
|
$messages = [
|
|
'nombre.unique' => 'El nombre que ingresó ya se encuentra en nuestros registros.'
|
|
];
|
|
return $messages;
|
|
}
|
|
}
|