51 lines
1.6 KiB
PHP
51 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class AvisoRequest 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()
|
|
{
|
|
return [
|
|
'mensagem' => 'required|string|max:140',
|
|
'is_ativo' => 'required|boolean',
|
|
'periodo.start' => 'required|date',
|
|
'periodo.end' => 'required|date|after_or_equal:periodo.start',
|
|
'dias_semana' => 'array',
|
|
'hora_inicial' => 'required|date_format:H:i:s',
|
|
'hora_final' => 'required|date_format:H:i:s|after:hora_inicial',
|
|
'intervalo' => 'required|integer|in:15,30,60,120,180,240',
|
|
];
|
|
}
|
|
|
|
public function messages()
|
|
{
|
|
return [
|
|
'mensagem.required' => 'A mensagem é obrigatória.',
|
|
'is_ativo.required' => 'O campo "Ativo" é obrigatório.',
|
|
'periodo.start.required' => 'A data inicial é obrigatória.',
|
|
'periodo.end.after_or_equal' => 'A data final deve ser posterior ou igual à data inicial.',
|
|
'hora_inicial.required' => 'A hora inicial é obrigatória.',
|
|
'hora_final.required' => 'A hora final é obrigatória e deve ser após a hora inicial.',
|
|
'intervalo.in' => 'O intervalo deve ser de 15, 30, 60, 120, 180, 240 minutos.',
|
|
];
|
|
}
|
|
}
|