File size: 554 Bytes
5f32fbd | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | <?php
namespace App\Http\Requests\Chatbot;
use Illuminate\Foundation\Http\FormRequest;
class ChatbotTrainingRequest extends FormRequest
{
public function rules(): array
{
$array = [
'type' => 'required|string',
];
if ($this->input('type') == 'url' || $this->input('type') == 'pdf') {
$array['chatbot_data'] = 'required|array';
$array['chatbot_data.*'] = 'sometimes|nullable|integer';
}
return $array;
}
protected function prepareForValidation(): void {}
}
|