45 lines
910 B
PHP
45 lines
910 B
PHP
<?php
|
|
|
|
namespace App\Http\Requests;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class ChatRequest 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 [
|
|
'message' => ['required'],
|
|
'attachment' => ['sometimes']
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Get the validation messages of rules that apply to the request.
|
|
*
|
|
* @return array
|
|
*/
|
|
public function messages()
|
|
{
|
|
return [
|
|
'message.required' => translate('message is required'),
|
|
'attachment.required' => translate('attachment is required')
|
|
];
|
|
}
|
|
}
|