Answer
extends CrmClientModel
in package
This class represents an answer It has a method to submit answers
Tags
Table of Contents
- $answers : array<string|int, Answer>
- $id : string
- $question : string
- $type : QuestionType
- $modelFields : array<string|int, mixed>
- The crm customer fields
- $validation : array<string|int, mixed>
- Validation rules
- $answer : string
- The actual answer as a string
- $id : int
- The question id
- __construct() : mixed
- Answer
- jsonSerialize() : array<string|int, mixed>
- Serialize this object to an array
- setQuestionAnswers() : bool
- Set unanswered question for a specific customer
Properties
$answers
public
array<string|int, Answer>
$answers
An array with answers
$id
public
string
$id
The answer id
$question
public
string
$question
The actual question as a string
$type
public
QuestionType
$type
The question type to display, it also hints wether it can accept one or multiple responses, so only checkbox allows multiple responses
$modelFields
The crm customer fields
protected
array<string|int, mixed>
$modelFields
= ['id', 'answer']
$validation
Validation rules
protected
static array<string|int, mixed>
$validation
= ['id' => 'required|int', 'answer' => 'required|string|max:255']
$answer
The actual answer as a string
private
string
$answer
= null
Required Max length 255 Field Type varchar
$id
The question id
private
int
$id
Required Field Type bigInt
Methods
__construct()
Answer
public
__construct([array<string|int, mixed> $properties = [] ]) : mixed
Parameters
- $properties : array<string|int, mixed> = []
Tags
Return values
mixed —jsonSerialize()
Serialize this object to an array
public
jsonSerialize() : array<string|int, mixed>
Return values
array<string|int, mixed> —setQuestionAnswers()
Set unanswered question for a specific customer
public
static setQuestionAnswers(string $hashcode, int $questionId, array<string|int, mixed> $answersId) : bool
Parameters
- $hashcode : string
-
The customer hashcode.
- $questionId : int
-
The question id.
- $answersId : array<string|int, mixed>
-
An array with answers id.
Tags
Return values
bool —true if succeeded