-
app/Http/Requests/ConversationObjectRequestTrait.php
Open in GitHubuse App\Rules\OdId; use OpenDialogAi\Core\Conversation\ConversationObject; trait ConversationObjectRequestTrait { public function odIdRule(ConversationObject $parent = null, string $currentUid = null): array { return [ 'od_id' => ['bail', 'string', 'filled', 'not_regex:/[\$\:\/]/', new OdId($parent, $currentUid)], ]; } }
-
app/Http/Requests/TurnRequest.php
Open in GitHubuse Illuminate\Foundation\Http\FormRequest; use OpenDialogAi\Core\Conversation\ConversationObject; class TurnRequest extends FormRequest { use ConversationObjectRequestTrait; public function rules() { $parent = $this->route('scene'); $currentUid = $this->get('id'); return $this->odIdRule($parent, $currentUid) + [ 'id' => 'string', 'name' => 'string', 'description' => 'string', 'interpreter' => 'nullable|string', 'behaviors' => 'array', 'conditions' => 'array', 'valid_origins' => 'array', 'intents' => 'array' ]; } }